-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
72 additions
and
72 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
on: | ||
push: | ||
# Sequence of patterns matched against refs/tags | ||
tags: | ||
- 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 | ||
|
||
name: Release | ||
permissions: write-all | ||
|
||
jobs: | ||
release: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 # Fetch all history for changelog generation | ||
- name: Get last tag | ||
id: last_tag | ||
run: | | ||
echo "::set-output name=tag::$(git describe --tags --abbrev=0 $(git rev-list --tags --max-count=1))" | ||
- name: Generate changelog | ||
id: changelog | ||
run: | | ||
# Initialize changelog variables | ||
FEAT="" | ||
FIX="" | ||
DOCS="" | ||
OTHER="" | ||
# Generate changelog by parsing commit messages | ||
git log ${{ steps.last_tag.outputs.tag }}..HEAD --pretty=format:"%s" | while read line; do | ||
if [[ $line == feat:* ]]; then | ||
FEAT="${FEAT}- ${line#feat: }\n" | ||
elif [[ $line == fix:* ]]; then | ||
FIX="${FIX}- ${line#fix: }\n" | ||
elif [[ $line == docs:* ]]; then | ||
DOCS="${DOCS}- ${line#docs: }\n" | ||
else | ||
OTHER="${OTHER}- $line\n" | ||
fi | ||
done | ||
# Set changelog outputs | ||
echo "::set-output name=feat::$FEAT" | ||
echo "::set-output name=fix::$FIX" | ||
echo "::set-output name=docs::$DOCS" | ||
echo "::set-output name=other::$OTHER" | ||
- name: Create Release | ||
id: create_release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.TOKEN }} | ||
with: | ||
tag_name: ${{ github.ref }} | ||
release_name: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
body: | | ||
**Features**: | ||
${{ steps.changelog.outputs.feat }} | ||
**Fixes**: | ||
${{ steps.changelog.outputs.fix }} | ||
**Documentation**: | ||
${{ steps.changelog.outputs.docs }} | ||
**Other**: | ||
${{ steps.changelog.outputs.other }} |