Some checks failed
Release / build-and-release (push) Failing after 1m31s
- Go 后端 (Gin + GORM + SQLite) 提供 API 和纯文本脚本服务 - Vite + React + TypeScript + Tailwind 前端 - 单二进制部署 (Go embed 前端静态文件) - Gitea Actions CI/CD: 打标签自动构建多平台 Release - 支持 bash/zsh/sh/fish/python3/node/ruby/php 8种运行环境 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
78 lines
2.2 KiB
YAML
78 lines
2.2 KiB
YAML
name: Release
|
|
|
|
on:
|
|
push:
|
|
tags:
|
|
- "v*"
|
|
|
|
jobs:
|
|
build-and-release:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
|
|
- name: Setup Node.js
|
|
uses: actions/setup-node@v4
|
|
with:
|
|
node-version: 20
|
|
cache: "npm"
|
|
cache-dependency-path: frontend/package-lock.json
|
|
|
|
- name: Build frontend
|
|
run: |
|
|
cd frontend
|
|
npm ci
|
|
npm run build
|
|
|
|
- name: Setup Go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version: "1.22"
|
|
cache-dependency-path: backend/go.sum
|
|
|
|
- name: Build all platforms
|
|
run: |
|
|
cp -r frontend/dist backend/internal/assets/dist/
|
|
cd backend
|
|
|
|
GOOS=linux GOARCH=amd64 go build -o scriptforge-server-linux-amd64 ./cmd/server
|
|
GOOS=linux GOARCH=arm64 go build -o scriptforge-server-linux-arm64 ./cmd/server
|
|
GOOS=windows GOARCH=amd64 go build -o scriptforge-server-windows-amd64.exe ./cmd/server
|
|
|
|
- name: Create Release
|
|
id: create_release
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
|
run: |
|
|
REPO="${{ gitea.repository }}"
|
|
TAG="${{ gitea.ref_name }}"
|
|
|
|
RELEASE_JSON=$(curl -s -X POST \
|
|
"https://gitea.kmux.cn/api/v1/repos/${REPO}/releases" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-H "Content-Type: application/json" \
|
|
-d "{
|
|
\"tag_name\": \"${TAG}\",
|
|
\"name\": \"${TAG}\",
|
|
\"body\": \"ScriptForge ${TAG}\",
|
|
\"draft\": false,
|
|
\"prerelease\": false
|
|
}")
|
|
|
|
echo "release_id=$(echo "$RELEASE_JSON" | jq -r '.id')" >> "$GITHUB_OUTPUT"
|
|
|
|
- name: Upload Release Assets
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.TOKEN }}
|
|
run: |
|
|
REPO="${{ gitea.repository }}"
|
|
RELEASE_ID="${{ steps.create_release.outputs.release_id }}"
|
|
|
|
for FILE in backend/scriptforge-server-*; do
|
|
echo "Uploading $FILE..."
|
|
curl -s -X POST \
|
|
"https://gitea.kmux.cn/api/v1/repos/${REPO}/releases/${RELEASE_ID}/assets" \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
-F "attachment=@${FILE}"
|
|
done
|