From 9fd284e5563d42a6b35062ba7daec42d8bffc050 Mon Sep 17 00:00:00 2001 From: ywkj Date: Fri, 20 Mar 2026 21:17:45 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20CI=20=E5=8E=BB=E6=8E=89=20golang=20conta?= =?UTF-8?q?iner=EF=BC=8C=E5=9C=A8=20node:20-bookworm=20=E9=87=8C=E7=9B=B4?= =?UTF-8?q?=E6=8E=A5=E8=A3=85=20Go?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 避免拉 golang 镜像的网络延迟,直接下载 Go tarball 编译。 Co-Authored-By: Claude Opus 4.6 --- .forgejo/workflows/release.yml | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/.forgejo/workflows/release.yml b/.forgejo/workflows/release.yml index 5176870..07809a4 100644 --- a/.forgejo/workflows/release.yml +++ b/.forgejo/workflows/release.yml @@ -8,19 +8,23 @@ on: jobs: release: runs-on: docker - container: - image: golang:1.22-bookworm steps: - uses: actions/checkout@v4 + - name: Install Go + run: | + curl -fsSL https://go.dev/dl/go1.22.12.linux-amd64.tar.gz | tar -C /usr/local -xz + echo "/usr/local/go/bin" >> $GITHUB_PATH + - name: Build all platforms run: | + export PATH="/usr/local/go/bin:$PATH" cd cli for pair in darwin/arm64 darwin/amd64 linux/amd64 linux/arm64; do os="${pair%/*}" arch="${pair#*/}" echo "Building auth-rt-${os}-${arch}..." - GOOS="$os" GOARCH="$arch" go build -ldflags="-s -w" -o "../auth-rt-${os}-${arch}" . + GOOS="$os" GOARCH="$arch" CGO_ENABLED=0 go build -ldflags="-s -w" -o "../auth-rt-${os}-${arch}" . done ls -lh ../auth-rt-* @@ -30,8 +34,6 @@ jobs: FORGEJO_TOKEN: ${{ secrets.FORGEJO_TOKEN }} API_URL: ${{ github.server_url }}/api/v1/repos/${{ github.repository }} run: | - apt-get update -qq && apt-get install -y -qq curl jq > /dev/null 2>&1 - # Create release RELEASE_ID=$(curl -s -X POST "$API_URL/releases" \ -H "Authorization: token $FORGEJO_TOKEN" \ @@ -51,7 +53,7 @@ jobs: echo "" done - # Also maintain a "latest" release + # Maintain "latest" release LATEST_ID=$(curl -s "$API_URL/releases/tags/latest" \ -H "Authorization: token $FORGEJO_TOKEN" | jq -r '.id // empty') @@ -62,13 +64,11 @@ jobs: curl -s -X DELETE "$API_URL/releases/$LATEST_ID/assets/$aid" \ -H "Authorization: token $FORGEJO_TOKEN" done - # Update release body curl -s -X PATCH "$API_URL/releases/$LATEST_ID" \ -H "Authorization: token $FORGEJO_TOKEN" \ -H "Content-Type: application/json" \ -d "{\"body\":\"auth-rt latest (from $TAG)\"}" else - # Create latest release LATEST_ID=$(curl -s -X POST "$API_URL/releases" \ -H "Authorization: token $FORGEJO_TOKEN" \ -H "Content-Type: application/json" \ @@ -76,7 +76,6 @@ jobs: | jq -r '.id') fi - # Upload to latest for f in auth-rt-*; do curl -s -X POST "$API_URL/releases/$LATEST_ID/assets?name=$f" \ -H "Authorization: token $FORGEJO_TOKEN" \