Skip to content

Commit 00909d8

Browse files
committed
ci: improve version bump workflow to handle no new commits
- Add fallback for when there are no new commits to bump - Handle potential failures in changelog generation - Ensure workflow continues even without new versions or changes
1 parent 078738f commit 00909d8

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/bump-version.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,15 @@ jobs:
3535
run: |
3636
git config --local user.email "github-actions[bot]@users.noreply.github.com"
3737
git config --local user.name "github-actions[bot]"
38-
output=$(cz bump --yes)
39-
version=$(echo "$output" | grep -oP '(?<=tag: v).*')
38+
output=$(cz bump --yes || echo "NO_BUMP")
39+
if [[ $output == *"NO_BUMP"* ]]; then
40+
echo "No new version to bump. Using current version."
41+
version=$(cz version --project)
42+
else
43+
version=$(echo "$output" | grep -oP '(?<=tag: v).*')
44+
fi
4045
echo "version=$version" >> $GITHUB_OUTPUT
41-
changelog=$(cz changelog)
46+
changelog=$(cz changelog || echo "No changes")
4247
echo "changelog<<EOF" >> $GITHUB_OUTPUT
4348
echo "$changelog" >> $GITHUB_OUTPUT
4449
echo "EOF" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)