Skip to content

Commit

Permalink
[ignore] Added a release PR step to calculate version bump type
Browse files Browse the repository at this point in the history
  • Loading branch information
samiib committed Jul 20, 2024
1 parent e866c1d commit 4b48156
Showing 1 changed file with 29 additions and 5 deletions.
34 changes: 29 additions & 5 deletions .github/workflows/release_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: release_pr
on:
push:
branches:
- master
- release-pr-test

jobs:
release-pr:
Expand All @@ -14,18 +14,42 @@ jobs:
- name: Unshallow
run: git fetch --prune --unshallow

# git-cliff to generate CHANGELOG.md
# git-cliff generates CHANGELOG.md
- uses: actions/setup-python@v5
with:
python-version: '3.10'
- run: pip install git-cliff typos
- name: Check new changlog entry for version bump type
id: type
run: |
changelog=$(git cliff --unreleased)
case $changelog in
*"BREAKING CHANGES:"* )
echo "MAJOR"
echo "bump="MAJOR"" >> $GITHUB_OUTPUT
;;
*"IMPROVEMENTS:"* )
echo "MINOR"
echo "bump="MINOR"" >> $GITHUB_OUTPUT
;;
*"DEPRECATIONS:"* )
echo "MINOR"
echo "bump="MINOR"" >> $GITHUB_OUTPUT
;;
* )
echo "PATCH"
echo "bump="PATCH"" >> $GITHUB_OUTPUT
;;
esac
# The --with-commit inserts a commit message to git-cliff without it being in the history.
# It is used here to dynamically add version bump commands.
- name: Get next version
id: vars
run: echo "version=$(git cliff --bumped-version)" >> $GITHUB_OUTPUT
run: echo "version=$(git cliff --bumped-version --with-commit "${{ steps.type.outputs.bump }}":" commit")" >> $GITHUB_OUTPUT
- name: Generate changelog output
run: git cliff --bump --unreleased
run: git cliff --bump --unreleased --with-commit "${{ steps.type.outputs.bump }}":" commit"
- name: Prepend new changelog entry
run: git cliff --bump --unreleased -p CHANGELOG.md
run: git cliff --bump --unreleased -p CHANGELOG.md --with-commit "${{ steps.type.outputs.bump }}":" commit"

# Generate annotation_unsupported.go
- uses: actions/setup-go@v5
Expand Down

0 comments on commit 4b48156

Please sign in to comment.