release: Fix check tag

This commit is contained in:
世界 2024-12-20 21:14:25 +08:00
parent 1676e13d3e
commit d4cd564dbe
No known key found for this signature in database
GPG Key ID: CD109927C34A63C4

View File

@ -170,7 +170,8 @@ jobs:
echo "HOME=$HOME" >> "$GITHUB_ENV" echo "HOME=$HOME" >> "$GITHUB_ENV"
- name: Set tag - name: Set tag
run: |- run: |-
git tag v${{ needs.calculate_version.outputs.version }} git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
git tag v${{ needs.calculate_version.outputs.version }} -f
- name: Build - name: Build
if: matrix.goos != 'android' if: matrix.goos != 'android'
run: |- run: |-
@ -230,7 +231,8 @@ jobs:
/usr/lib/jvm/java-17-openjdk-amd64/bin/java --version /usr/lib/jvm/java-17-openjdk-amd64/bin/java --version
- name: Set tag - name: Set tag
run: |- run: |-
git tag v${{ needs.calculate_version.outputs.version }} git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
git tag v${{ needs.calculate_version.outputs.version }} -f
- name: Build library - name: Build library
run: |- run: |-
make lib_install make lib_install
@ -304,7 +306,8 @@ jobs:
/usr/lib/jvm/java-17-openjdk-amd64/bin/java --version /usr/lib/jvm/java-17-openjdk-amd64/bin/java --version
- name: Set tag - name: Set tag
run: |- run: |-
git tag v${{ needs.calculate_version.outputs.version }} git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
git tag v${{ needs.calculate_version.outputs.version }} -f
- name: Build library - name: Build library
run: |- run: |-
make lib_install make lib_install
@ -401,7 +404,8 @@ jobs:
- name: Set tag - name: Set tag
if: matrix.if if: matrix.if
run: |- run: |-
git tag v${{ needs.calculate_version.outputs.version }} git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
git tag v${{ needs.calculate_version.outputs.version }} -f
echo "VERSION=${{ needs.calculate_version.outputs.version }}" >> "$GITHUB_ENV" echo "VERSION=${{ needs.calculate_version.outputs.version }}" >> "$GITHUB_ENV"
- name: Checkout main branch - name: Checkout main branch
if: matrix.if && github.ref == 'refs/heads/main-next' && github.event_name != 'workflow_dispatch' if: matrix.if && github.ref == 'refs/heads/main-next' && github.event_name != 'workflow_dispatch'
@ -562,7 +566,8 @@ jobs:
go install -v . go install -v .
- name: Set tag - name: Set tag
run: |- run: |-
git tag v${{ needs.calculate_version.outputs.version }} git ls-remote --exit-code --tags origin v${{ needs.calculate_version.outputs.version }} || echo "PUBLISHED=false" >> "$GITHUB_ENV"
git tag v${{ needs.calculate_version.outputs.version }} -f
echo "VERSION=${{ needs.calculate_version.outputs.version }}" >> "$GITHUB_ENV" echo "VERSION=${{ needs.calculate_version.outputs.version }}" >> "$GITHUB_ENV"
- name: Download builds - name: Download builds
uses: actions/download-artifact@v4 uses: actions/download-artifact@v4
@ -579,8 +584,16 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }}
- name: Upload builds - name: Upload builds
if: ${{ env.PUBLISHED == 'false' }}
run: |- run: |-
export PATH="$PATH:$HOME/go/bin" export PATH="$PATH:$HOME/go/bin"
ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release ghr --replace --draft --prerelease -p 5 "v${VERSION}" dist/release
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Replace builds
if: ${{ env.PUBLISHED != 'false' }}
run: |-
export PATH="$PATH:$HOME/go/bin"
ghr --replace -p 5 "v${VERSION}" dist/release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}