🐛 fix: ensure single push in CI/CD workflow
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
#!/bin/bash
|
||||
# CI script to handle automatic version bumping
|
||||
# Usage: scripts/ci-version-bump.sh <commit_message>
|
||||
# Usage: scripts/ci-version-bump.sh <commit_message> [--no-push]
|
||||
|
||||
set -e
|
||||
|
||||
@@ -11,6 +11,14 @@ fi
|
||||
|
||||
LAST_COMMIT=$1
|
||||
VERSION_BUMPED="false"
|
||||
NO_PUSH=false
|
||||
|
||||
# Parse flags
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = "--no-push" ]; then
|
||||
NO_PUSH=true
|
||||
fi
|
||||
done
|
||||
|
||||
# Automatic version bump based on commit type
|
||||
if echo "$LAST_COMMIT" | grep -q "^✨ feat:"; then
|
||||
@@ -47,6 +55,13 @@ if [ "$VERSION_BUMPED" = "true" ]; then
|
||||
|
||||
git add VERSION cmd/server/main.go README.md
|
||||
if git commit -m "chore: auto version bump [skip ci]"; then
|
||||
# Skip push if --no-push flag is set
|
||||
if [ "$NO_PUSH" = true ]; then
|
||||
echo "Skipping git push due to --no-push flag"
|
||||
echo "Successfully bumped version to $NEW_VERSION (committed locally)"
|
||||
exit 0
|
||||
fi
|
||||
|
||||
# Try push with retry logic for race conditions
|
||||
for i in 1 2 3; do
|
||||
if git push; then
|
||||
|
||||
Reference in New Issue
Block a user