Skip to content

Use the Force, Luke. Bump version: 0.7.1 β†’ 0.8.0 #19

Use the Force, Luke. Bump version: 0.7.1 β†’ 0.8.0

Use the Force, Luke. Bump version: 0.7.1 β†’ 0.8.0 #19

name: Update CHANGELOG.md Automatically
on:
push:
tags:
- "**"
env:
default_branch: master
skip_generate_pr: false
head_branch: ci_pull_request
jobs:
update_changelog:
name: Update CHANGELOG.md
runs-on: macos-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install git-chglog
run: |
brew tap git-chglog/git-chglog
brew install git-chglog
- name: Checkout Branch
run: |
git config --global push.autoSetupRemote true
git status
git fetch --all
git pull origin master
# git checkout -b $default_branch origin/$default_branch
# git pull -r
git checkout -b $head_branch
- name: Delete Remote Previous Head Branch for PR
run: |
if [[ `git ls-remote --heads origin $head_branch` ]]; then
git push origin --delete $head_branch
fi
- name: Generate CHANGELOG.md
run: |
git-chglog -o CHANGELOG.md
- name: Commit & Push Changes
run: |
if [[ `git status --porcelain` ]]; then
git add --all
git commit -m "chore(ci): auto update CHANGELOG.md"
git push
else
skip_generate_pr=true
exit 0
fi
- name: Create Pull Request
if: ${{ env.skip_generate_pr }} == false
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr create \
-B $default_branch \
--title '[CI] Auto Update CHANGELOG.md' \
--body 'Update report \
- CHANGELOG.md' \
-a Lguanghui \
-r Lguanghui \
-l [ci]auto_update
# deprecated due to `master` is a protected branch
# - name: Commit & Push changes
# uses: actions-js/push@master
# with:
# github_token: ${{ secrets.GITHUB_TOKEN }}
# branch: 'master'
# message: 'chore(ci): auto update CHANGELOG.md ${date}'