11# docs: https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions
22
33name : Release
4+ run-name : Release ${{ inputs.newversion }} ${{ inputs.prerelease == 'true' && '(prerelease)' || '' }}
45
56on :
67 workflow_dispatch :
2324 default : rc
2425 required : false
2526 prerelease :
26- description : " This a pre-release"
27+ description : " This is a pre-release"
2728 type : boolean
2829 default : false
2930 required : false
3031
3132permissions : {}
3233
3334env :
34- # https://nodejs.dev/en/about/releases/
35- NODE_ACTIVE_LTS : " 24"
35+ NODE_ACTIVE_LTS : " 24" # https://nodejs.org/en/about/releases/
3636
3737jobs :
3838 bump :
6060 uses : actions/setup-node@v6
6161 with :
6262 node-version : ${{ env.NODE_ACTIVE_LTS }}
63+ package-manager-cache : false
64+ # # ! no npm build at the moment
6365 - name : bump VERSION
6466 id : bump
6567 run : |
@@ -82,10 +84,12 @@ jobs:
8284 needs :
8385 - " bump"
8486 name : publish NPMJS
85- permissions :
86- id-token : write
8787 runs-on : ubuntu-latest
8888 timeout-minutes : 30
89+ permissions :
90+ id-token : write # Enables provenance signing via OIDC
91+ env :
92+ NPMJS_RELEASE_TAG : ${{ github.event.inputs.prerelease == 'true' && 'unstable-prerelease' || 'latest' }}
8993 steps :
9094 - name : Checkout code
9195 # see https://github.com/actions/checkout
@@ -97,16 +101,29 @@ jobs:
97101 uses : actions/setup-node@v6
98102 with :
99103 node-version : ${{ env.NODE_ACTIVE_LTS }}
104+ package-manager-cache : false
105+ # no explicit npm build. if a build is required, it should be configured as prepublish/prepublishOnly script of npm.
100106 - name : login to NPMJS
101107 run : npm config set "//registry.npmjs.org/:_authToken=$NPMJS_AUTH_TOKEN"
102108 env :
103109 NPMJS_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
104- - name : publish to NPMJS as "latest"
105- if : ${{ github.event.inputs.prerelease != 'true' }}
106- run : npm publish --provenance --access public --tag 'latest'
107- - name : publish to NPMJS as "unstable-prerelease"
108- if : ${{ github.event.inputs.prerelease == 'true' }}
109- run : npm publish --provenance --access public --tag 'unstable-prerelease'
110+ - name : publish to NPMJS as "${{ env.NPMJS_RELEASE_TAG }}"
111+ run : >
112+ npm publish
113+ --provenance
114+ --access public
115+ --tag "$NPMJS_RELEASE_TAG"
116+ - name : pack release result
117+ run : |
118+ mkdir -p "$PACKED_DIR"
119+ npm pack --pack-destination "$PACKED_DIR"
120+ - name : artifact release result
121+ # see https://github.com/actions/upload-artifact
122+ uses : actions/upload-artifact@v6
123+ with :
124+ name : ${{ env.PACKED_ARTIFACT }}
125+ path : ${{ env.PACKED_DIR }}/
126+ if-no-files-found : error
110127
111128 release-GH :
112129 needs :
0 commit comments