-
Notifications
You must be signed in to change notification settings - Fork 0
52 lines (43 loc) · 1.31 KB
/
release.yml
File metadata and controls
52 lines (43 loc) · 1.31 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
name: release
on:
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
fetch-depth: 0
- uses: actions/setup-node@v6
with:
node-version: 24
- name: Create GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: |
version="$(node -p 'require("./package.json").version')"
tag="v${version}"
if gh release view "$tag" >/dev/null 2>&1; then
echo "::error::Release $tag already exists"
exit 1
fi
if git rev-parse --verify --quiet "refs/tags/$tag" >/dev/null; then
echo "::error::Tag $tag already exists"
exit 1
fi
previous_tag="$(git describe --tags --abbrev=0 --match 'v*' 2>/dev/null || true)"
{
echo "Release $tag."
echo
echo "## Commits"
echo
if [ -n "$previous_tag" ]; then
git log --pretty=format:'- %h %s' "$previous_tag..HEAD"
else
git log --pretty=format:'- %h %s'
fi
echo
} > release-notes.md
gh release create "$tag" --target "$GITHUB_SHA" --title "$tag" --notes-file release-notes.md