Skip to content

Commit a417294

Browse files
authored
ci: automate the release process adding npm provenance (#13)
* chore: bootstrap releases for path: . * ci: automate the release process adding npm provenance
1 parent 0bece8e commit a417294

File tree

4 files changed

+44
-20
lines changed

4 files changed

+44
-20
lines changed

.github/workflows/ci.yml

+24-18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json
12
name: CI
23

34
on:
@@ -35,28 +36,33 @@ jobs:
3536
run: npm run test
3637

3738
publish:
39+
if: github.ref == 'refs/heads/main' && github.event_name == 'push'
3840
name: 📦 Publish
3941
runs-on: ubuntu-latest
4042
needs: lint-test
41-
if: github.ref == 'refs/heads/main'
43+
permissions:
44+
# Needed by googleapis/release-please-action@v4
45+
contents: write
46+
pull-requests: write
47+
# Needed by `npm publish --provenance`
48+
id-token: write
4249

4350
steps:
44-
- name: 👍 Checkout
45-
uses: actions/checkout@v4
46-
47-
- name: 🐢 Setup node.js
48-
uses: actions/setup-node@v4
51+
- name: 🍄 Bump package version, create GitHub release, and update changelog
52+
uses: googleapis/release-please-action@v4
53+
id: release
54+
- uses: actions/checkout@v4
55+
if: ${{ steps.release.outputs.release_created }}
56+
- uses: actions/setup-node@v4
57+
if: ${{ steps.release.outputs.release_created }}
4958
with:
50-
node-version: 20
51-
cache: 'npm'
52-
53-
- name: 📥 Install Dependencies
54-
run: npm install
55-
56-
- name: 🛠️ Build
57-
run: npm run build
58-
59+
node-version: lts/*
60+
registry-url: https://registry.npmjs.org
5961
- name: 🚀 Publish to npm
60-
uses: JS-DevTools/npm-publish@v3
61-
with:
62-
token: ${{ secrets.NPM_TOKEN }}
62+
if: ${{ steps.release.outputs.release_created }}
63+
run: |
64+
npm install
65+
npm run build --if-present
66+
npm publish --provenance
67+
env:
68+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.release-please-manifest.json

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
{
2+
".": "1.1.1"
3+
}

package-lock.json

+2-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

release-please-config.json

+15
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
{
2+
"packages": {
3+
".": {
4+
"changelog-path": "CHANGELOG.md",
5+
"release-type": "node",
6+
"pull-request-title-pattern": "chore: release ${version}",
7+
"pull-request-header": "🍄 Release bump",
8+
"bump-minor-pre-major": true,
9+
"bump-patch-for-minor-pre-major": false,
10+
"draft": false,
11+
"prerelease": false
12+
}
13+
},
14+
"$schema": "https://raw.githubusercontent.com/googleapis/release-please/main/schemas/config.json"
15+
}

0 commit comments

Comments
 (0)