File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Release (prepare)
2+
3+ on :
4+ push :
5+ branches : [main]
6+
7+ permissions :
8+ contents : write
9+ pull-requests : write
10+
11+ jobs :
12+ prepare :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v4
16+ with :
17+ fetch-depth : 0
18+
19+ - uses : pnpm/action-setup@v4
20+ with :
21+ version : 9
22+
23+ - uses : actions/setup-node@v4
24+ with :
25+ node-version : ' 20'
26+ cache : ' pnpm'
27+
28+ - run : pnpm install --frozen-lockfile
29+
30+ # Opens/updates the Version Packages PR; no publishing here
31+ - name : Create/Update Version PR
32+ uses : changesets/action@v1
33+ with :
34+ title : ' chore(release): version packages'
35+ env :
36+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
37+
Original file line number Diff line number Diff line change 1+ name : Publish to npm
2+
3+ on :
4+ release :
5+ types : [published]
6+ workflow_dispatch : {}
7+
8+ permissions :
9+ contents : read
10+ id-token : write
11+
12+ concurrency :
13+ group : publish-${{ github.ref }}
14+ cancel-in-progress : false
15+
16+ jobs :
17+ publish :
18+ runs-on : ubuntu-latest
19+ steps :
20+ - uses : actions/checkout@v4
21+ with :
22+ fetch-depth : 0
23+
24+ - uses : pnpm/action-setup@v4
25+ with :
26+ version : 9
27+
28+ - uses : actions/setup-node@v4
29+ with :
30+ node-version : ' 20'
31+ cache : ' pnpm'
32+ registry-url : ' https://registry.npmjs.org'
33+
34+ - run : pnpm install --frozen-lockfile
35+
36+ - name : Verify release tag matches package.json
37+ run : |
38+ TAG="${GITHUB_REF_NAME#v}"
39+ PKG_VERSION=$(node -p "require('./package.json').version")
40+ if [ "$TAG" != "$PKG_VERSION" ]; then
41+ echo "Tag v$TAG does not match package.json $PKG_VERSION"; exit 1
42+ fi
43+
44+ - run : pnpm test
45+ - run : pnpm run build
46+
47+ - name : Authenticate to npm
48+ run : echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
49+ env :
50+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
51+
52+ - name : Publish
53+ run : pnpm publish --access public --provenance --no-git-checks
54+
You can’t perform that action at this time.
0 commit comments