@@ -60,30 +60,27 @@ jobs:
6060 with :
6161 ref : ${{ inputs.tag || github.ref }}
6262
63- # Trusted publishing (OIDC). Configure once on npmjs.com → package → Trusted Publisher:
64- # Organization: devrecated Repository: autodevelop-cli Workflow: release.yml
65- # NPM_TOKEN is a fallback only; prefer OIDC (npm ≥ 11.5.1).
6663 - uses : actions/setup-node@v7
6764 with :
6865 node-version : " 22.14"
69- registry-url : https://registry.npmjs.org
7066
67+ # npm automation token (repo secret NPM_TOKEN). Same path as manual `npm publish` from packaging/npm.
7168 - name : Publish npm package
7269 env :
73- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
70+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
7471 VER : ${{ inputs.tag || github.ref_name }}
7572 run : |
7673 set -euo pipefail
74+ if [ -z "${NODE_AUTH_TOKEN:-}" ]; then
75+ echo "NPM_TOKEN not set — skipping npm publish (publish locally from packaging/npm if needed)." >&2
76+ exit 0
77+ fi
7778 VER="${VER#v}"
7879 if ! [[ "$VER" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
7980 echo "Refusing to publish with version '$VER' (expected semver from tag)." >&2
8081 exit 1
8182 fi
82- if [ -n "${NPM_TOKEN:-}" ]; then
83- export NODE_AUTH_TOKEN="$NPM_TOKEN"
84- fi
85- unset NPM_TOKEN
8683 node -e "const fs=require('fs'); const p=JSON.parse(fs.readFileSync('package.json','utf8')); p.version=process.env.VER; fs.writeFileSync('package.json', JSON.stringify(p,null,2)+'\n')"
87- npm install -g npm@^11.5.1
88- npm publish --provenance -- access public
84+ echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > .npmrc
85+ npm publish --access public
8986 npm view "@devrecated/autodevelop@${VER}" version
0 commit comments