-
Notifications
You must be signed in to change notification settings - Fork 2
68 lines (54 loc) · 1.62 KB
/
release.yml
File metadata and controls
68 lines (54 loc) · 1.62 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
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
name: Create Release
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: tag_name
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
- name: Install pnpm
uses: pnpm/action-setup@v2
with:
version: 9
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 22.x
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Validate version matches tag
run: |
TAG_VERSION="${GITHUB_REF#refs/tags/v}"
PKG_VERSION=$(node -p "require('./package.json').version")
if [ "$TAG_VERSION" != "$PKG_VERSION" ]; then
echo "::error::Tag v$TAG_VERSION does not match package.json version $PKG_VERSION"
exit 1
fi
- name: Run tests
run: pnpm test
- name: Build
run: pnpm run build
- name: Publish to npm
run: pnpm publish --no-git-checks --provenance
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
- name: Create Release
uses: softprops/action-gh-release@v1
with:
files: dist/**/*
body: |
## Version ${{ steps.tag_name.outputs.VERSION }}
See [CHANGELOG.md](./CHANGELOG.md) for release details.
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}