1- name : Publish packages to npmjs (OIDC)
1+ # .github/workflows/publish-npm.yml
2+ name : Publish package to npmjs (OIDC)
23
34on :
45 workflow_call :
56 inputs :
6- publish_core :
7- required : true
8- type : boolean
9- publish_front :
10- required : true
11- type : boolean
7+ package_dir :
8+ description : " Path to the package to publish"
9+ required : false
10+ type : string
11+ default : " packages/core"
1212
1313jobs :
1414 publish :
1515 runs-on : ubuntu-latest
16+
17+ # Required for npm Trusted Publishing (OIDC)
1618 permissions :
1719 contents : read
1820 id-token : write
1921
2022 steps :
2123 - uses : actions/checkout@v4
2224
25+ # Use a modern Node that can run npm 11+, and/or install npm 11.5.1+ explicitly
2326 - uses : actions/setup-node@v4
2427 with :
2528 node-version : " 24"
2629 registry-url : " https://registry.npmjs.org"
2730
28- - name : Ensure npm supports Trusted Publishing
31+ # Ensure the npm version meets the Trusted Publishing requirement
32+ - name : Ensure npm >= 11.5.1
2933 run : |
30- npm --version
31- # Trusted publishing requires npm CLI 11.5.1+ :contentReference[oaicite:4]{index=4}
3234 npm i -g npm@^11.5.1
3335 npm --version
3436
35- - name : Install dependencies (root)
37+ # If you use Yarn (you do), keep it for install/build
38+ - name : Install deps
3639 run : |
3740 corepack enable
3841 yarn install --immutable
3942
40- - name : Publish core
41- if : ${{ inputs.publish_core }}
42- working-directory : packages/core
43+ # Publish via npm CLI (OIDC happens automatically; no NODE_AUTH_TOKEN)
44+ - name : Publish Core
4345 run : npm publish --access public
46+ working-directory : packages/core
4447
45- - name : Publish front
46- if : ${{ inputs.publish_front }}
47- working-directory : packages/front
48+ - name : Publish Front
4849 run : npm publish --access public
50+ working-directory : packages/front
0 commit comments