4444 id : cache-node-modules
4545 uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
4646 with :
47- key : node-modules-dev-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json') }}
47+ key : node-modules-dev-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock .json') }}
4848 path : |
4949 node_modules
5050 - name : Install debug NPM packages
@@ -109,6 +109,9 @@ jobs:
109109 matrix :
110110 rust-version :
111111 - 1.80.0
112+ outputs :
113+ attestation-id : ${{ steps.attestation.outputs.attestation-id }}
114+ attestation-url : ${{ steps.attestation.outputs.attestation-url }}
112115 steps :
113116 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
114117 with :
@@ -133,33 +136,33 @@ jobs:
133136 - name : Cache npm install
134137 uses : actions/cache@5a3ec84eff668545956fd18022155c47e93e2684 # v4.2.3
135138 with :
136- key : node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package.json') }}
139+ key : node-modules-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('package-lock .json') }}
137140 path : |
138141 node_modules
139142
140143 - name : Install NPM packages
141144 run : |
142145 npm install
143146
144- - name : Perform release build
145- run : |
146- npm run build:release
147-
148147 - name : Create release package
149148 working-directory : ${{ needs.meta.outputs.project-dir }}
150149 run : |
151150 npm pack
152151
153152 - uses : actions/attest-build-provenance@e8998f949152b193b063cb0ec769d69d929409be # v2.4.0
153+ id : attestation
154154 with :
155- subject-path : ${{ needs.meta.outputs.artifacts-glob }}
155+ subject-path : ${{ needs.meta.outputs.artifact-name }}
156+
157+ - run : |
158+ mv ${{ steps.attestation.outputs.bundle-path }} attestation.json
156159
157160 - uses : actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
158161 with :
159162 if-no-files-found : error
160- name : componentize-js
161163 path : |
162- ${{ needs.meta.outputs.artifacts-glob }}
164+ ${{ needs.meta.outputs.artifact-name }}
165+ attestation.json
163166
164167 test-npm-release :
165168 runs-on : ubuntu-24.04
@@ -176,10 +179,10 @@ jobs:
176179 - name : Test built componentize-js NPM package
177180 shell : bash
178181 run : |
179- export PACKAGE_DIR =${{ github.workspace }}/artifacts/componentize-js /${{ needs.meta.outputs.artifact-name }}
182+ export PACKAGE_FILE_PATH =${{ github.workspace }}/artifacts/artifact /${{ needs.meta.outputs.artifact-name }}
180183 cp -r examples/hello-world/guest /tmp/test
181184 cd /tmp/test
182- npm install --save $PACKAGE_DIR
185+ npm install --save $PACKAGE_FILE_PATH
183186 npm run all
184187
185188 npm-publish :
@@ -192,6 +195,10 @@ jobs:
192195 steps :
193196 - uses : actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
194197
198+ - uses : actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
199+ with :
200+ node-version : " >=22"
201+
195202 - name : Add npmrc
196203 run : |
197204 echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > .npmrc
@@ -205,7 +212,8 @@ jobs:
205212 NPM_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
206213 shell : bash
207214 run : |
208- export PACKAGE_DIR=${{ github.workspace }}/artifacts/componentize-js/${{ needs.meta.outputs.artifact-name }}
215+ export PACKAGE_FILE_PATH=${{ github.workspace }}/artifacts/artifact/${{ needs.meta.outputs.artifact-name }}
216+ export ATTESTATION_FILE_PATH=${{ github.workspace }}/artifacts/artifact/attestation.json
209217
210218 export OPT_DRY_RUN="--dry-run"
211219 if [ "tag" == "${{ github.ref_type }}" ]; then
@@ -217,7 +225,14 @@ jobs:
217225 export OPT_RELEASE_TAG="--tag ${{ needs.meta.outputs.prerelease-tag }}";
218226 fi
219227
220- npm publish -w @bytecodealliance/componentize-js $OPT_DRY_RUN $OPT_RELEASE_TAG $PACKAGE_DIR --access=public
228+ npm publish \
229+ --verbose \
230+ -w @bytecodealliance/componentize-js \
231+ --access=public \
232+ --provenance-file=$ATTESTATION_FILE_PATH \
233+ $OPT_DRY_RUN \
234+ $OPT_RELEASE_TAG \
235+ $PACKAGE_FILE_PATH
221236
222237 create-gh-release :
223238 runs-on : ubuntu-24.04
0 commit comments