Publish to npm with provenance

This commit is contained in:
Reto Brunner 2023-04-25 22:36:42 +02:00
commit 9ee1cf13a8
2 changed files with 12 additions and 2 deletions

View file

@ -1,5 +1,8 @@
name: Build
permissions:
contents: read
on: [push, pull_request]
jobs:

View file

@ -1,5 +1,9 @@
name: Release
permissions:
contents: read
id-token: write
on:
push:
tags: v*
@ -29,15 +33,18 @@ jobs:
- name: Test
run: yarn test
- name: Update npm
run: npm install -g npm
- name: Publish latest
if: "!contains(github.ref, '-')"
run: npm publish --tag latest
run: npm publish --tag latest --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
- name: Publish next
if: contains(github.ref, '-')
run: npm publish --tag next
run: npm publish --tag next --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}