-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (57 loc) · 1.62 KB
/
release.yml
File metadata and controls
65 lines (57 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
name: Release
on:
push:
tags:
- "v*.*.*"
permissions:
contents: write
jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
cache: npm
- run: npm ci
- name: Verify dist/ is committed
shell: bash
run: |
npm run build
if ! git diff --exit-code --quiet dist/; then
echo "::error::dist/ is stale on this tag. Re-tag after running 'npm run build'."
exit 1
fi
- name: Move floating major-version tag
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
tag="${GITHUB_REF##*/}"
major="${tag%%.*}"
echo "Moving ${major} to ${tag}"
git tag -f "${major}" "${tag}"
git push --force origin "refs/tags/${major}"
- name: Create GitHub release
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
shell: bash
run: |
set -euo pipefail
tag="${GITHUB_REF##*/}"
notes_file="$(mktemp)"
if [ -f CHANGELOG.md ]; then
awk -v ver="${tag#v}" '
/^## \[?'"${tag#v}"'\]?/ { capture=1; next }
/^## / && capture { exit }
capture { print }
' CHANGELOG.md > "$notes_file"
fi
if [ ! -s "$notes_file" ]; then
echo "Release ${tag}" > "$notes_file"
fi
gh release create "$tag" --title "$tag" --notes-file "$notes_file"