feat(cli): add provenance to ci template (#1671)

This commit is contained in:
LongYinan 2023-07-27 10:31:58 +08:00 committed by GitHub
parent 5875378c88
commit 9ebe404e9a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -5,6 +5,10 @@ env:
DEBUG: 'napi:*' DEBUG: 'napi:*'
MACOSX_DEPLOYMENT_TARGET: '10.13' MACOSX_DEPLOYMENT_TARGET: '10.13'
permissions:
contents: write
id-token: write
on: on:
push: push:
branches: branches:
@ -390,6 +394,10 @@ jobs:
name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }} name: Test bindings on aarch64-unknown-linux-musl - node@\${{ matrix.node }}
needs: needs:
- build - build
strategy:
fail-fast: false
matrix:
node: ['16', '18']
runs-on: ubuntu-latest runs-on: ubuntu-latest
@ -421,7 +429,7 @@ jobs:
- name: Setup and run tests - name: Setup and run tests
uses: addnab/docker-run-action@v3 uses: addnab/docker-run-action@v3
with: with:
image: node:lts-alpine image: node:\${{ matrix.node }}-alpine
options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build options: --platform linux/arm64 -v \${{ github.workspace }}:/build -w /build
run: | run: |
set -e set -e
@ -548,6 +556,7 @@ jobs:
- name: Publish - name: Publish
run: | run: |
npm config set provenance true
if git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$"; if git log -1 --pretty=%B | grep "^[0-9]\\+\\.[0-9]\\+\\.[0-9]\\+$";
then then
echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc echo "//registry.npmjs.org/:_authToken=$NPM_TOKEN" >> ~/.npmrc