refactor: use golang:alpine container with direct clone
Some checks failed
Release / build (push) Failing after 2m30s

This commit is contained in:
2026-04-07 08:12:22 +08:00
parent a3bc91bdaf
commit 4b12c90e50

View File

@@ -5,32 +5,25 @@ on:
tags: tags:
- 'v*' - 'v*'
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
GOSUMDB: "off"
jobs: jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
container:
image: golang:1.26-alpine
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v4 run: git clone https://hub.gaomia.site/titor/yoyo.git .
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: '1.26'
- name: Build - name: Build
run: | run: |
platforms=("linux/amd64" "linux/arm64" "darwin/amd64" "darwin/arm64" "windows/amd64") for p in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
for p in "${platforms[@]}"; do
os=${p%/*} os=${p%/*}
arch=${p#*/} arch=${p#*/}
ext="" ext=""
[ "$os" = "windows" ] && ext=".exe" [ "$os" = "windows" ] && ext=".exe"
output="yoo-${os}-${arch}${ext}" GOOS=$os GOARCH=$arch go build -o "yoo-${os}-${arch}${ext}" ./cmd/yoyo/main.go
GOOS=$os GOARCH=$arch go build -o "$output" ./cmd/yoyo/main.go
done done
- name: Checksums - name: Checksums
@@ -39,18 +32,18 @@ jobs:
- name: Release - name: Release
env: env:
GITEA_TOKEN: ${{ secrets.release_token }} GITEA_TOKEN: ${{ secrets.release_token }}
GITEA_REPO: ${{ github.repository }}
TAG_NAME: ${{ github.ref_name }}
run: | run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
# 创建 Release # 创建 Release
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/${GITEA_REPO}/releases" \ curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG_NAME#refs/tags/}\",\"name\":\"${TAG_NAME#refs/tags/}\",\"body\":\"Automated release\"}" -d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"Automated release\"}"
# 上传产物 # 上传产物
for f in yoo-* checksums.txt; do for f in yoo-* checksums.txt; do
[ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/${GITEA_REPO}/releases/upload?name=${TAG_NAME#refs/tags/}" \ [ -f "$f" ] && curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases/upload?name=${TAG_NAME}" \
-H "Authorization: token ${GITEA_TOKEN}" \ -H "Authorization: token ${GITEA_TOKEN}" \
-F "attachment=@$f" -F "attachment=@$f"
done done