Repository navigation
100 lines (89 loc) · 2.79 KB
/
Copy pathrelease.yml
File metadata and controls
100 lines (89 loc) · 2.79 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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
name: Release NPM package
on:
push:
tags: ["v*"]
pull_request:
types: [closed]
permissions:
contents: read
concurrency:
group: npm-release
cancel-in-progress: false
jobs:
build:
if: >-
github.event_name == 'push' ||
(github.event.pull_request.merged == true &&
github.event.pull_request.base.ref == github.event.repository.default_branch &&
github.event.pull_request.head.repo.full_name == github.repository &&
github.event.pull_request.head.ref == 'release/next')
runs-on: ubuntu-latest
name: Node build
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: "24.x"
package-manager-cache: false
- uses: pnpm/action-setup@v3
with:
version: 11.13.0
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- run: pnpm build
- run: pnpm run test
- run: pnpm run lint:pkg
- run: pnpm run typecheck
- run: pnpm run test:package-types
release:
needs: [build]
runs-on: ubuntu-latest
name: Release
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v6
with:
ref: ${{ github.event.pull_request.merge_commit_sha || github.sha }}
- name: Setup node
uses: actions/setup-node@v6
with:
node-version: "24.x"
registry-url: "https://registry.npmjs.org"
package-manager-cache: false
- uses: pnpm/action-setup@v3
with:
version: 11.13.0
run_install: |
- recursive: true
args: [--frozen-lockfile, --strict-peer-dependencies]
- name: Install npm with trusted publishing support
run: npm install --global npm@11
- name: Publish to npm
run: |
version=$(node -p "require('./package.json').version")
if [ "$GITHUB_EVENT_NAME" = "push" ] && [ "$GITHUB_REF_NAME" != "v$version" ]; then
echo "Git tag must match package.json version (v$version)"
exit 1
fi
if [[ "$version" == *-* ]]; then
npm publish --tag next
else
npm publish --tag latest
fi
- name: Create GitHub release and tag
env:
GH_TOKEN: ${{ github.token }}
run: |
version=$(node -p "require('./package.json').version")
args=()
if [[ "$version" == *-* ]]; then
args+=(--prerelease)
fi
gh release create "v$version" --target "$(git rev-parse HEAD)" \
--title "v$version" --generate-notes "${args[@]}"