-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (53 loc) · 1.59 KB
/
publish.yml
File metadata and controls
65 lines (53 loc) · 1.59 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
name: Publish
on:
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install pnpm
uses: pnpm/action-setup@v4
with:
version: 10.12.4
- name: Use Node.js 22.14
uses: actions/setup-node@v4
with:
node-version: 22.14.0
cache: pnpm
registry-url: https://registry.npmjs.org
- name: Install dependencies
run: pnpm install --frozen-lockfile
- name: Upgrade npm for trusted publishing
run: npm install -g npm@latest
- name: Print runtime versions
run: node -v && npm -v
- name: Publish current main release
run: pnpm release
- name: Read package version
id: package_version
run: echo "version=$(node -p \"require('./package.json').version\")" >> "$GITHUB_OUTPUT"
- name: Create Git tag if missing
run: |
TAG="v${{ steps.package_version.outputs.version }}"
if git rev-parse "$TAG" >/dev/null 2>&1; then
echo "Tag $TAG already exists"
exit 0
fi
git tag "$TAG"
git push origin "$TAG"
- name: Create GitHub Release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
TAG="v${{ steps.package_version.outputs.version }}"
gh release create "$TAG" \
--title "$TAG" \
--generate-notes \
--verify-tag