File tree Expand file tree Collapse file tree 1 file changed +31
-1
lines changed
Expand file tree Collapse file tree 1 file changed +31
-1
lines changed Original file line number Diff line number Diff line change 1717 if : github.event.workflow_run.conclusion == 'success'
1818 runs-on : ubuntu-latest
1919 steps :
20+ - name : Detect npm publish eligibility
21+ id : npm_gate
22+ shell : bash
23+ env :
24+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
25+ run : |
26+ set -euo pipefail
27+ echo "publish_npm=false" >> "$GITHUB_OUTPUT"
28+
29+ if [ -z "${NPM_TOKEN:-}" ]; then
30+ echo "::notice::NPM_TOKEN is empty; npm publish disabled for this run."
31+ exit 0
32+ fi
33+
34+ printf '%s\n' "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > "$HOME/.npmrc"
35+
36+ if ! npm whoami >/dev/null 2>&1; then
37+ echo "::warning::NPM_TOKEN is invalid/revoked; npm publish disabled for this run."
38+ exit 0
39+ fi
40+
41+ # Current workspace publishes @effect-template/* packages.
42+ if ! npm access ls-packages effect-template >/dev/null 2>&1; then
43+ echo "::warning::No publish access to npm scope 'effect-template'; npm publish disabled for this run."
44+ exit 0
45+ fi
46+
47+ echo "publish_npm=true" >> "$GITHUB_OUTPUT"
48+ echo "::notice::npm publish is enabled for this run."
49+
2050 - uses : ProverCoderAI/action-release@v1.0.17
2151 with :
2252 github_token : ${{ secrets.GITHUB_TOKEN }}
2656 package_json_path : packages/app/package.json
2757 pnpm_filter : ./packages/app
2858 bump_type : patch
29- publish_npm : false
59+ publish_npm : ${{ steps.npm_gate.outputs.publish_npm }}
3060 publish_github_packages : true
3161 skip_if_unchanged : true
3262 cancel_on_no_changes : true
You can’t perform that action at this time.
0 commit comments