43 lines
1.0 KiB
YAML
43 lines
1.0 KiB
YAML
name: Create Release
|
|
|
|
on:
|
|
push:
|
|
tags: ['v*']
|
|
|
|
permissions:
|
|
contents: write
|
|
|
|
jobs:
|
|
release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Generate changelog
|
|
id: changelog
|
|
run: |
|
|
# Get previous tag
|
|
PREV_TAG=$(git describe --tags --abbrev=0 HEAD^ 2>/dev/null || echo "")
|
|
|
|
if [ -z "$PREV_TAG" ]; then
|
|
# First release - get all commits
|
|
CHANGES=$(git log --pretty=format:"- %s" HEAD)
|
|
else
|
|
# Get commits since last tag
|
|
CHANGES=$(git log --pretty=format:"- %s" ${PREV_TAG}..HEAD)
|
|
fi
|
|
|
|
# Write to file for multiline support
|
|
echo "$CHANGES" > changelog.txt
|
|
|
|
- name: Create Release
|
|
uses: softprops/action-gh-release@v1
|
|
with:
|
|
body_path: changelog.txt
|
|
generate_release_notes: true
|
|
env:
|
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|