Skip to content

Commit 34b2096

Browse files
committed
ci: create github release on version tags
1 parent c0324a5 commit 34b2096

1 file changed

Lines changed: 58 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,3 +46,61 @@ jobs:
4646
run: npm publish ./npm --access public
4747
env:
4848
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
49+
50+
github-release:
51+
runs-on: ubuntu-latest
52+
needs: [publish-jsr, publish-npm]
53+
54+
permissions:
55+
contents: write
56+
57+
steps:
58+
- uses: actions/checkout@v4
59+
with:
60+
fetch-depth: 0
61+
62+
- name: Verify tag matches deno.json version
63+
shell: bash
64+
run: |
65+
set -euo pipefail
66+
tag="${GITHUB_REF_NAME}"
67+
version="${tag#v}"
68+
deno_version="$(node -p "require('./deno.json').version")"
69+
if [[ "${deno_version}" != "${version}" ]]; then
70+
echo "Tag '${tag}' does not match deno.json version '${deno_version}'."
71+
exit 1
72+
fi
73+
74+
- name: Generate changelog
75+
shell: bash
76+
run: |
77+
set -euo pipefail
78+
tag="${GITHUB_REF_NAME}"
79+
80+
prev_tag="$(
81+
git tag --list "v*" --sort=-version:refname \
82+
| grep -v "^${tag}$" \
83+
| head -n 1 || true
84+
)"
85+
86+
{
87+
echo "# ${tag}"
88+
echo
89+
if [[ -n "${prev_tag}" ]]; then
90+
echo "Changes since ${prev_tag}:"
91+
echo
92+
git log --no-merges --pretty=format:"- %s (%h)" "${prev_tag}..${tag}"
93+
else
94+
echo "Changes:"
95+
echo
96+
git log --no-merges --pretty=format:"- %s (%h)" "${tag}"
97+
fi
98+
echo
99+
} > RELEASE_NOTES.md
100+
101+
- name: Create GitHub release
102+
uses: softprops/action-gh-release@v2
103+
with:
104+
name: ${{ github.ref_name }}
105+
tag_name: ${{ github.ref_name }}
106+
body_path: RELEASE_NOTES.md

0 commit comments

Comments
 (0)