Skip to content

Commit bd60a1d

Browse files
committed
fix: git push the changes from semantic release
1 parent 836c7e6 commit bd60a1d

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

.github/workflows/Manual_Publish_Docker.yml

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -77,17 +77,22 @@ jobs:
7777
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
7878
run: |
7979
set -e
80-
# Delete the local tag if it exists
81-
git tag -l "v*" | xargs -r git tag -d
82-
# Fetch all tags from remote
83-
git fetch --tags
84-
# Run semantic-release with --dry-run first to check if a release would be created
85-
if npx semantic-release --dry-run; then
86-
npx semantic-release
80+
81+
# Configure git user
82+
git config --global user.name 'github-actions[bot]'
83+
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
84+
85+
# Fetch only the latest tag instead of all tags
86+
git fetch --depth=1 origin refs/tags/*:refs/tags/*
87+
88+
# Run semantic-release with force flag
89+
if npx semantic-release; then
90+
# Force push to handle any tag conflicts on re-runs
91+
git push --follow-tags --force origin HEAD:${{ github.ref }}
8792
else
8893
# If no new release would be created, set the outputs manually
8994
echo "new_release_published=false" >> $GITHUB_OUTPUT
90-
# Get the latest tag as the version
95+
# Get the latest tag without requiring all tags
9196
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
9297
if [ ! -z "$LATEST_TAG" ]; then
9398
echo "new_release_version=${LATEST_TAG#v}" >> $GITHUB_OUTPUT

0 commit comments

Comments
 (0)