Skip to content

Commit a862500

Browse files
author
iexitdev
committed
ci(release): pass npm token to publish step
1 parent 9bbf524 commit a862500

2 files changed

Lines changed: 13 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ jobs:
150150
done
151151
env:
152152
NPM_TAG: ${{ steps.package.outputs.npm_tag }}
153+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
153154

154155
- name: Verify npm registry publish state
155156
run: npm run release:publish:status -- --strict

scripts/check-release-gates.mjs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ const requiredFiles = [
2121
"docs/release/h5-owner-decision-memo.md",
2222
"docs/release/h6-owner-decision-memo.md",
2323
"docs/release/known-issues.md",
24+
"docs/release/native-workflow-runbook.md",
2425
"docs/release/native-qa-checklists.md",
2526
"docs/release/native-performance-benchmark.md",
2627
"docs/release/native-release-checks.md",
@@ -586,6 +587,11 @@ addCheck({
586587
});
587588

588589
const publishWorkflowSource = await readRepoFile(".github/workflows/publish.yml");
590+
const publishAuthEnvCount = (
591+
publishWorkflowSource.match(
592+
/NODE_AUTH_TOKEN:\s*\$\{\{\s*secrets\.NPM_TOKEN\s*\}\}/g
593+
) ?? []
594+
).length;
589595
const publishWorkflowSafetyChecks = [
590596
"secrets.NPM_TOKEN",
591597
"NODE_AUTH_TOKEN",
@@ -597,6 +603,12 @@ const publishWorkflowSafetyChecks = [
597603
"npm publish \"${PUBLISH_TARGET}\" --ignore-scripts --access public --provenance --tag"
598604
].filter((needle) => !publishWorkflowSource.includes(needle));
599605

606+
if (publishAuthEnvCount < 2) {
607+
publishWorkflowSafetyChecks.push(
608+
"NODE_AUTH_TOKEN must be set for npm auth preflight and npm publish"
609+
);
610+
}
611+
600612
addCheck({
601613
detail:
602614
publishWorkflowSafetyChecks.length > 0

0 commit comments

Comments
 (0)