@@ -31,16 +31,26 @@ jobs:
3131 - name : Update versions and push
3232 id : push
3333 run : |
34- ./scripts/bump_version.sh ${{ inputs.version }}
35- git config user.name "GitHub Actions"
36- git config user.email "actions@github.com"
37- git add packages/*/pyproject.toml
38- git commit -m "chore: release v${{ inputs.version }}"
39- git push origin main
34+ # Check current version
35+ CURRENT_VERSION=$(grep "^version" packages/leann-core/pyproject.toml | cut -d'"' -f2)
36+ echo "Current version: $CURRENT_VERSION"
37+ echo "Target version: ${{ inputs.version }}"
38+
39+ if [ "$CURRENT_VERSION" = "${{ inputs.version }}" ]; then
40+ echo "⚠️ Version is already ${{ inputs.version }}, skipping update"
41+ COMMIT_SHA=$(git rev-parse HEAD)
42+ else
43+ ./scripts/bump_version.sh ${{ inputs.version }}
44+ git config user.name "GitHub Actions"
45+ git config user.email "actions@github.com"
46+ git add packages/*/pyproject.toml
47+ git commit -m "chore: release v${{ inputs.version }}"
48+ git push origin main
49+ COMMIT_SHA=$(git rev-parse HEAD)
50+ echo "✅ Pushed version update: $COMMIT_SHA"
51+ fi
4052
41- COMMIT_SHA=$(git rev-parse HEAD)
4253 echo "commit-sha=$COMMIT_SHA" >> $GITHUB_OUTPUT
43- echo "✅ Pushed version update: $COMMIT_SHA"
4454
4555 build-packages :
4656 name : Build packages
@@ -93,12 +103,24 @@ jobs:
93103
94104 - name : Create release
95105 run : |
96- git tag "v${{ inputs.version }}"
97- git push origin "v${{ inputs.version }}"
106+ # Check if tag already exists
107+ if git rev-parse "v${{ inputs.version }}" >/dev/null 2>&1; then
108+ echo "⚠️ Tag v${{ inputs.version }} already exists, skipping tag creation"
109+ else
110+ git tag "v${{ inputs.version }}"
111+ git push origin "v${{ inputs.version }}"
112+ echo "✅ Created and pushed tag v${{ inputs.version }}"
113+ fi
98114
99- gh release create "v${{ inputs.version }}" \
100- --title "Release v${{ inputs.version }}" \
101- --notes "🚀 Released to PyPI: https://pypi.org/project/leann/${{ inputs.version }}/" \
102- --latest
115+ # Check if release already exists
116+ if gh release view "v${{ inputs.version }}" >/dev/null 2>&1; then
117+ echo "⚠️ Release v${{ inputs.version }} already exists, skipping release creation"
118+ else
119+ gh release create "v${{ inputs.version }}" \
120+ --title "Release v${{ inputs.version }}" \
121+ --notes "🚀 Released to PyPI: https://pypi.org/project/leann/${{ inputs.version }}/" \
122+ --latest
123+ echo "✅ Created GitHub release v${{ inputs.version }}"
124+ fi
103125 env :
104126 GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments