Skip to content

Commit e239952

Browse files
committed
Add GitHub release automation from tags
1 parent bfae71a commit e239952

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

.github/workflows/release.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Make releases from tags
2+
on:
3+
push:
4+
tags: ['[0-9]+.[0-9]+.[0-9]+*']
5+
6+
jobs:
7+
publish:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v5
11+
12+
# Source: https://medium.com/@usman_qb
13+
- name: Create release body
14+
id: create_release_body
15+
run: |
16+
RELEASEVERSION="[${{ github.ref_name }}]"
17+
echo "Version: $RELEASEVERSION"
18+
RELEASEBODY=$(awk -v ver="$RELEASEVERSION" '/^## / { if (p) { exit }; if ($2 == ver) { p=1; next } } p && NF' CHANGELOG.md)
19+
{
20+
echo 'RELEASEBODY<<EOF'
21+
echo "${RELEASEBODY}"
22+
echo EOF
23+
} >> $GITHUB_OUTPUT
24+
25+
- name: Create Release
26+
env:
27+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
28+
run: |
29+
echo "Creating release for ${{ github.ref_name }}"
30+
echo "${{ steps.create_release_body.outputs.RELEASEBODY }}"
31+
gh release create "${{ github.ref_name }}" --title "release_${{ github.ref_name }}" --notes "${{ steps.create_release_body.outputs.RELEASEBODY }}"
32+
echo "Release created successfully"

0 commit comments

Comments
 (0)