-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #11 from ryanrozich/update-gh-action-skip-version-…
…commit-message
- Loading branch information
Showing
2 changed files
with
51 additions
and
20 deletions.
There are no files selected for viewing
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 |
---|---|---|
|
@@ -27,42 +27,31 @@ jobs: | |
git diff main HEAD~1 --name-only > changes.txt | ||
echo "::set-output name=status::$(grep -qvE '^docs/|^README.md|^\.env\.sample$|^config\.json\.sample$|^\.github/workflows/|\.bumpversion\.cfg$' changes.txt && echo 'code' || echo 'docs')" | ||
# Conditional step based on changes | ||
- name: Version Bump and Push | ||
if: steps.determine_changes.outputs.status == 'code' | ||
run: | | ||
bump2version patch --config-file .bumpversion.cfg | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git push --tags | ||
- name: Get last commit message | ||
id: get-commit-message | ||
run: echo "::set-output name=message::$(git log -1 --pretty=%B)" | ||
|
||
- name: Determine version bump type | ||
if: steps.determine_changes.outputs.status == 'code' | ||
id: version-bump-type | ||
run: | | ||
echo "Commit message: ${{ steps.get-commit-message.outputs.message }}" | ||
if echo "${{ steps.get-commit-message.outputs.message }}" | grep -q "MAJOR:"; then | ||
echo "Commit message: ${{ github.event.head_commit.message }}" | ||
if echo "${{ github.event.head_commit.message }}" | grep -q "\[skip version\]"; then | ||
echo "::set-output name=type::skip" | ||
elif echo "${{ github.event.head_commit.message }}" | grep -q "MAJOR:"; then | ||
echo "::set-output name=type::major" | ||
elif echo "${{ steps.get-commit-message.outputs.message }}" | grep -q "MINOR:"; then | ||
elif echo "${{ github.event.head_commit.message }}" | grep -q "MINOR:"; then | ||
echo "::set-output name=type::minor" | ||
else | ||
echo "::set-output name=type::patch" | ||
fi | ||
- name: Bump version | ||
if: steps.determine_changes.outputs.status == 'code' | ||
run: bumpversion ${{ steps.version-bump-type.outputs.type }} | ||
|
||
- name: Push changes | ||
if: steps.determine_changes.outputs.status == 'code' | ||
- name: Version Bump and Push | ||
if: steps.version-bump-type.outputs.type != 'skip' | ||
run: | | ||
bump2version ${{ steps.version-bump-type.outputs.type }} --config-file .bumpversion.cfg | ||
git config --local user.email "[email protected]" | ||
git config --local user.name "GitHub Action" | ||
git push && git push --tags | ||
git push --tags | ||
- name: Build and publish | ||
if: steps.determine_changes.outputs.status == 'code' | ||
|
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