Skip to content

Commit 5c069eb

Browse files
committed
ci: automate latest tag release on v* tags
1 parent f8d4f8e commit 5c069eb

1 file changed

Lines changed: 20 additions & 6 deletions

File tree

.github/workflows/ci.yml

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -57,21 +57,35 @@ jobs:
5757

5858
release:
5959
needs: build
60-
if: startsWith(github.ref, 'refs/tags/')
60+
if: startsWith(github.ref, 'refs/tags/v')
6161
runs-on: ubuntu-latest
6262
steps:
6363
- uses: actions/checkout@v6
6464
- uses: actions/download-artifact@v8
6565
with:
6666
name: python-build
6767
path: dist/
68-
- name: Update latest tag
68+
- name: Release version tag
69+
uses: softprops/action-gh-release@v3
70+
with:
71+
files: dist/**/*
72+
- name: Update latest release
73+
env:
74+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
6975
run: |
76+
gh release delete latest --cleanup-tag -y || true
7077
git config user.name "github-actions[bot]"
7178
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
7279
git tag -fa latest -m "Update latest tag to ${{ github.ref_name }}"
7380
git push origin latest --force
74-
- name: Release
75-
uses: softprops/action-gh-release@v3
76-
with:
77-
files: dist/**/*
81+
82+
files=()
83+
while IFS= read -r -d '' file; do
84+
files+=("$file")
85+
done < <(find dist -type f -print0)
86+
87+
if [ ${#files[@]} -gt 0 ]; then
88+
gh release create latest "${files[@]}" --title "latest" --notes "Latest release mirrored from ${{ github.ref_name }}"
89+
else
90+
gh release create latest --title "latest" --notes "Latest release mirrored from ${{ github.ref_name }}"
91+
fi

0 commit comments

Comments
 (0)