Files
yoyo/.gitea/workflows/release.yaml
titor 4b12c90e50
Some checks failed
Release / build (push) Failing after 2m30s
refactor: use golang:alpine container with direct clone
2026-04-07 08:12:22 +08:00

49 lines
1.5 KiB
YAML

name: Release
on:
push:
tags:
- 'v*'
jobs:
build:
runs-on: ubuntu-latest
container:
image: golang:1.26-alpine
env:
GOPROXY: "https://mirrors.aliyun.com/goproxy/,direct"
steps:
- name: Checkout
run: git clone https://hub.gaomia.site/titor/yoyo.git .
- name: Build
run: |
for p in linux/amd64 linux/arm64 darwin/amd64 darwin/arm64 windows/amd64; do
os=${p%/*}
arch=${p#*/}
ext=""
[ "$os" = "windows" ] && ext=".exe"
GOOS=$os GOARCH=$arch go build -o "yoo-${os}-${arch}${ext}" ./cmd/yoyo/main.go
done
- name: Checksums
run: sha256sum yoo-* > checksums.txt
- name: Release
env:
GITEA_TOKEN: ${{ secrets.release_token }}
run: |
TAG_NAME="${GITHUB_REF#refs/tags/}"
# 创建 Release
curl -s -X POST "https://hub.gaomia.site/api/v1/repos/titor/yoyo/releases" \
-H "Authorization: token ${GITEA_TOKEN}" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"${TAG_NAME}\",\"name\":\"${TAG_NAME}\",\"body\":\"Automated release\"}"
# 上传产物
for f in yoo-* checksums.txt; do
[ -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}" \
-F "attachment=@$f"
done