Update pyproject.toml #138
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
name: Update Changelog | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
update-changelog: | |
runs-on: ubuntu-latest | |
env: | |
version: | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get the current version | |
id: current-version | |
run: echo "version=$(python setup.py --version)" >> $GITHUB_ENV | |
- name: Check if the commit message matches the release pattern | |
run: | | |
if [[ $(git log -1 --pretty=%B) != "Update changelog for v${{ env.version }}" ]]; then | |
echo "Commit message does not match the release pattern." | |
exit 1 | |
fi | |
- name: Update changelog | |
if: contains(github.event.head_commit.message, 'Update changelog for v${{ env.version }}') | |
run: | | |
PREVIOUS_VERSION=$(git tag -l --sort=-creatordate | head -n 1) | |
CHANGES=$(git log --pretty=format:"- %s (%h)" $PREVIOUS_VERSION..) | |
echo "# v${{ env.version }}" >> CHANGELOG.md | |
echo "## Changes" >> CHANGELOG.md | |
echo "$CHANGES" >> CHANGELOG.md | |
git config user.email "[email protected]" | |
git config user.name "Md. Musfiqur Rahaman" | |
git commit -am "Update CHANGELOG.md with latest version by GitHub Action" | |
git push |