Skip to content

Commit 60b4f73

Browse files
Modernize CI/CD: split workflows, add provenance, drop GPR
- Split into ci.yml (build/test on push/PR) and npmpublish.yml (publish on release) - Publish now triggers on GitHub releases instead of every push - Add --provenance flag for supply chain security - Add id-token: write permission for OIDC provenance - Remove GitHub Package Registry (GPR) publish job Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent a26740f commit 60b4f73

2 files changed

Lines changed: 29 additions & 35 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches:
6+
- main
7+
push:
8+
branches:
9+
- main
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
- uses: actions/setup-node@v4
17+
with:
18+
node-version: 22
19+
- run: npm ci
20+
- run: npm test

.github/workflows/npmpublish.yml

Lines changed: 9 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,49 +1,23 @@
1-
name: Node.js Package
1+
name: Publish to npm
22

33
on:
4-
pull_request:
5-
branches:
6-
- main
7-
push:
8-
branches:
9-
- main
4+
release:
5+
types: [published]
106

117
jobs:
12-
build:
13-
runs-on: ubuntu-latest
14-
steps:
15-
- uses: actions/checkout@v4
16-
- uses: actions/setup-node@v4
17-
with:
18-
node-version: 22
19-
- run: npm ci
20-
- run: npm test
21-
22-
publish-npm:
23-
needs: build
8+
publish:
249
runs-on: ubuntu-latest
10+
permissions:
11+
contents: read
12+
id-token: write
2513
steps:
2614
- uses: actions/checkout@v4
2715
- uses: actions/setup-node@v4
2816
with:
2917
node-version: 22
3018
registry-url: https://registry.npmjs.org/
3119
- run: npm ci
32-
- run: npm publish
20+
- run: npm test
21+
- run: npm publish --provenance --access public
3322
env:
3423
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
35-
36-
publish-gpr:
37-
needs: build
38-
runs-on: ubuntu-latest
39-
steps:
40-
- uses: actions/checkout@v4
41-
- uses: actions/setup-node@v4
42-
with:
43-
node-version: 22
44-
registry-url: https://npm.pkg.github.com/
45-
scope: '@Ghost---Shadow'
46-
- run: npm ci
47-
- run: npm publish
48-
env:
49-
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}

0 commit comments

Comments
 (0)