1818 description : ' The version to publish.'
1919 required : true
2020 type : string
21-
21+
22+ # It's required to set permissions to be able to:
23+ # - Authenticate to NPM with OIDC
24+ # See: https://docs.npmjs.com/trusted-publishers
25+ permissions :
26+ id-token : write
27+ contents : read
28+
2229jobs :
2330 publish-to-npm :
2431 name : Publish to NPM
@@ -34,33 +41,34 @@ jobs:
3441 with :
3542 version : ${{ inputs.version }}
3643
37- - uses : actions/setup-node@v3
44+ - uses : actions/setup-node@v4
3845 with :
39- node-version : 18.12.x
40- registry-url : https://registry.npmjs.org/
41- scope : ' @constructorio'
42- token : ${{ secrets.NPM_TOKEN }}
46+ node-version : 22.18.x
47+
48+ - name : Install npm 11
49+ run : npm install -g npm@11
50+
51+ - name : Debug node and npm versions
52+ run : node --version && npm --version
4353
4454 - name : Install dependencies
4555 run : npm ci
4656
4757 - name : Build compiled package for publishing
4858 uses : " ./.github/actions/compile"
49- with :
59+ with :
5060 version : ${{ inputs.version }}
5161
5262 - name : Update package.json version field
5363 id : update-version
5464 run : |
5565 # updates the package.json version field
5666 jq --arg new_version "${{ steps.version.outputs.without_prefix }}" '.version = $new_version' package.json > tmp.json && mv tmp.json package.json
57-
67+
5868 echo "new-version=$new_version" >> $GITHUB_OUTPUT
5969
6070 - name : Publish to NPM
6171 run : npm publish --access public
62- env :
63- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
6472
6573 - name : Notify Slack about new publish to NPM
6674 uses : ravsamhq/notify-slack-action@bca2d7f5660b833a27bda4f6b8bef389ebfefd25 # v2
0 commit comments