From 04a0ffdc503ad5f0c3eeca7eddb6373a91efadaa Mon Sep 17 00:00:00 2001 From: qaq Date: Sun, 17 Aug 2025 22:19:35 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E5=8D=8F=E8=AE=AE=E5=B1=8F?= =?UTF-8?q?=E8=94=BD=E6=94=AF=E6=8C=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/docker-build.yml | 45 +++++++++++++----------------- go-gost/main.go | 1 - 2 files changed, 20 insertions(+), 26 deletions(-) diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml index 38a28aa..fc9fb0b 100644 --- a/.github/workflows/docker-build.yml +++ b/.github/workflows/docker-build.yml @@ -71,32 +71,27 @@ jobs: env: GH_TOKEN: ${{ github.token }} run: | - # 删除已存在的 release 和 tag - gh release delete gost-latest --yes 2>/dev/null || echo "No existing release to delete" - - # 创建新的 release - gh release create gost-latest \ - --title "GOST Binary Latest" \ - --notes "GOST binary compiled from commit ${{ github.sha }} - - - Platform: Linux AMD64 - - Compressed with UPX - - Build date: ${{ github.event.head_commit.timestamp }}" \ - --repo ${{ github.repository }} + # 确保 tag 指向当前 commit + git tag -f gost-latest ${{ github.sha }} + git push origin gost-latest --force + + # 检查 release 是否存在,不存在则创建 + if gh release view gost-latest 2>/dev/null; then + echo "Release exists, will update assets" + else + echo "Release not found, creating new release" + gh release create gost-latest gost-latest \ + --title "GOST Binary Latest" \ + --notes "GOST binary compiled from commit ${{ github.sha }} +- Platform: Linux AMD64 +- Compressed with UPX +- Build date: ${{ github.event.head_commit.timestamp }}" \ + --repo ${{ github.repository }} + fi + + # 上传 asset 并覆盖同名文件 + gh release upload gost-latest ./go-gost/gost --clobber - - name: Upload GOST binary to Release - if: steps.gost-changes.outputs.gost == 'true' - env: - GH_TOKEN: ${{ github.token }} - run: | - # 删除已存在的 asset(如果有) - gh api repos/${{ github.repository }}/releases/tags/gost-latest/assets --jq '.[] | select(.name=="gost") | .id' | xargs -I {} gh api repos/${{ github.repository }}/releases/assets/{} -X DELETE 2>/dev/null || echo "No existing asset to delete" - - # 上传新的 asset - gh api repos/${{ github.repository }}/releases/tags/gost-latest/assets \ - -F name=gost \ - -F "data=@./go-gost/gost" \ - -H "Content-Type: application/octet-stream" build-vite: if: contains(github.event.head_commit.message, '[skip vite]') == false diff --git a/go-gost/main.go b/go-gost/main.go index f2e2b34..3bfdbdf 100644 --- a/go-gost/main.go +++ b/go-gost/main.go @@ -147,5 +147,4 @@ func main() { } // GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o gost -// // upx --best --lzma gost