Skip to content
name: Create Release, Auto Merge, and Update Changelog
on:
push:
tags:
- 'v*.*.*' # ? This will match tags like v2.0.1, v1.2.3, etc.
jobs:
process:
if: github.actor == 'GoodM4ven' # ! Hard-coded username
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Merge PR
run: |
PR_NUMBER=$(gh pr list --base main --state open --author [email protected] --json number --jq '.[0].number')
if [[ ! -z "$PR_NUMBER" ]]; then
gh pr merge $PR_NUMBER --merge
fi
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Extract release notes
run: |
echo "${{ github.event.head_commit.message }}" | sed '1d' > .github/release_body.md
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ github.ref }}
body_path: .github/release_body.md
draft: false
prerelease: false
- name: Update Changelog
uses: stefanzweifel/changelog-updater-action@v1
with:
latest-version: ${{ github.ref_name }}
release-notes: ${{ github.event.head_commit.message }}
- name: Commit updated CHANGELOG
uses: stefanzweifel/git-auto-commit-action@v4
with:
branch: master
commit_message: Update CHANGELOG
file_pattern: CHANGELOG.md