Skip to content

Commit

Permalink
ci: sets up automated publishing with provenance
Browse files Browse the repository at this point in the history
  • Loading branch information
sverweij committed Oct 27, 2023
1 parent a0cf3c3 commit 01ad66c
Show file tree
Hide file tree
Showing 7 changed files with 4,078 additions and 7 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
- uses: actions/cache@v3
with:
path: node_modules
key: ${{matrix.node-version}}@${{matrix.platform}}-build-${{hashFiles('package.json')}}
key: ${{matrix.node-version}}@${{matrix.platform}}-build-${{hashFiles('package-lock.json')}}
restore-keys: |
${{matrix.node-version}}@${{matrix.platform}}-build-
- uses: actions/setup-node@v4
Expand All @@ -43,7 +43,7 @@ jobs:
uses: actions/cache@v3
with:
path: .cache
key: ${{matrix.node-version}}@${{matrix.platform}}-build-eslint-${{hashFiles('package.json')}}
key: ${{matrix.node-version}}@${{matrix.platform}}-build-eslint-${{hashFiles('package-lock.json')}}
restore-keys: |
${{matrix.node-version}}@${{matrix.platform}}-build-eslint-
if: matrix.platform == 'ubuntu-latest' && matrix.node-version == env.NODE_LATEST
Expand All @@ -66,7 +66,7 @@ jobs:
- uses: actions/cache@v3
with:
path: node_modules
key: ${{env.NODE_LATEST}}@${{matrix.platform}}-build-${{hashFiles('package.json')}}
key: ${{env.NODE_LATEST}}@${{matrix.platform}}-build-${{hashFiles('package-lock.json')}}
restore-keys: |
${{env.NODE_LATEST}}@${{matrix.platform}}-build-
- uses: actions/setup-node@v4
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/prerelease.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: publish pre-releases as beta to npmjs
on:
release:
types: [prereleased]

jobs:
publish-as-beta:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 21.x
registry-url: https://registry.npmjs.org
- run: npm clean-install
- run: npm publish --provenance --access public --tag beta
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
21 changes: 21 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
name: publish to npmjs
on:
release:
types: [released]

jobs:
publish-as-latest:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v4
with:
node-version: 21.x
registry-url: https://registry.npmjs.org
- run: npm clean-install
- run: npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ dependency-violations.html
isolate-*-v8.log
npm-debug.log
yarn-error.log
package-lock.json
.pnp*
*.tgz
2 changes: 1 addition & 1 deletion .npmrc
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
package-lock = false
package-lock = true
save-exact = true
engine-strict = true

0 comments on commit 01ad66c

Please sign in to comment.