fix: CI 去掉 golang container,在 node:20-bookworm 里直接装 Go
Build and Release auth-rt / release (push) Failing after 2m25s
Details
Build and Release auth-rt / release (push) Failing after 2m25s
Details
避免拉 golang 镜像的网络延迟,直接下载 Go tarball 编译。 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
f03e09dca2
commit
9fd284e556
|
|
@ -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" \
|
||||
|
|
|
|||
Loading…
Reference in New Issue