mirror of
https://github.com/glittercowboy/get-shit-done
synced 2026-04-25 17:25:23 +02:00
44 lines
1.1 KiB
YAML
44 lines
1.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v[0-9]+.[0-9]+.[0-9]+'
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
contents: write
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Extract version from tag
|
|
id: version
|
|
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
|
|
|
|
- name: Extract changelog section
|
|
id: changelog
|
|
run: |
|
|
VERSION="${{ steps.version.outputs.VERSION }}"
|
|
awk -v ver="$VERSION" '
|
|
/^## \[/ {
|
|
if (found) exit
|
|
if ($0 ~ "\\[" ver "\\]") found=1
|
|
}
|
|
found {print}
|
|
' CHANGELOG.md > release_notes.md
|
|
|
|
if [ ! -s release_notes.md ]; then
|
|
echo "## v$VERSION" > release_notes.md
|
|
echo "" >> release_notes.md
|
|
echo "See [CHANGELOG.md](https://github.com/${{ github.repository }}/blob/main/CHANGELOG.md) for details." >> release_notes.md
|
|
fi
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body_path: release_notes.md
|