File tree Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Expand file tree Collapse file tree 1 file changed +13
-8
lines changed Original file line number Diff line number Diff line change @@ -77,17 +77,22 @@ jobs:
77
77
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78
78
run : |
79
79
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 }}
87
92
else
88
93
# If no new release would be created, set the outputs manually
89
94
echo "new_release_published=false" >> $GITHUB_OUTPUT
90
- # Get the latest tag as the version
95
+ # Get the latest tag without requiring all tags
91
96
LATEST_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "")
92
97
if [ ! -z "$LATEST_TAG" ]; then
93
98
echo "new_release_version=${LATEST_TAG#v}" >> $GITHUB_OUTPUT
You can’t perform that action at this time.
0 commit comments