45 lines
1.1 KiB
YAML
45 lines
1.1 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- 'v*'
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
name: Create Release
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
# Get previous tag
|
|
PREV_TAG=$(git tag --sort=-v:refname | sed -n '2p')
|
|
if [ -z "$PREV_TAG" ]; then
|
|
COMMITS=$(git log --pretty=format:"- %s (%h)" HEAD)
|
|
else
|
|
COMMITS=$(git log --pretty=format:"- %s (%h)" "${PREV_TAG}..HEAD")
|
|
fi
|
|
{
|
|
echo 'body<<EOF'
|
|
echo "## What's Changed"
|
|
echo ""
|
|
echo "$COMMITS"
|
|
echo ""
|
|
echo "**Full Changelog**: https://github.com/${{ github.repository }}/compare/${PREV_TAG:-$(git rev-list --max-parents=0 HEAD | head -1)}...${{ github.ref_name }}"
|
|
echo 'EOF'
|
|
} >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Create GitHub Release
|
|
uses: softprops/action-gh-release@v2
|
|
with:
|
|
body: ${{ steps.changelog.outputs.body }}
|
|
generate_release_notes: false
|