-
Notifications
You must be signed in to change notification settings - Fork 0
59 lines (51 loc) · 1.85 KB
/
Copy pathrelease.yml
File metadata and controls
59 lines (51 loc) · 1.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
id-token: write
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- uses: actions/setup-node@v5
with:
node-version: 22
registry-url: https://registry.npmjs.org
- run: npm ci
# The tag is the source of truth: publishing a tag that disagrees with
# package.json is how a version ends up on npm under the wrong number.
- name: Check the tag matches the package version
run: |
tag="${GITHUB_REF_NAME#v}"
version="$(node -p 'require("./package.json").version')"
test "$tag" = "$version" || {
echo "tag $tag does not match package version $version"
exit 1
}
- run: npm run typecheck
- run: npm run build
- run: npm run docs:build
- run: npm run docs:check
- run: npx playwright install --with-deps
- run: npm test
# Re-running a release, or tagging a version published by hand, should not
# fail the run — only an unpublished version is published here.
- name: Publish, unless this version is already on the registry
run: |
version="$(node -p 'require("./package.json").version')"
if npm view "partialkit@$version" version > /dev/null 2>&1; then
echo "partialkit@$version is already on the registry; skipping the publish"
exit 0
fi
npm publish --provenance --access public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Draft the GitHub release
run: |
gh release view "$GITHUB_REF_NAME" > /dev/null 2>&1 && exit 0
gh release create "$GITHUB_REF_NAME" --title "$GITHUB_REF_NAME" --notes-from-tag --verify-tag
env:
GH_TOKEN: ${{ github.token }}