Files
SingBox-Gopanel/.gitea/workflows/build.yml
CN-JS-HuiBai 9f6a4515c0
Some checks failed
build / build (api, amd64, linux) (push) Failing after -52s
build / build (api, arm64, linux) (push) Failing after -52s
build / build (api.exe, amd64, windows) (push) Failing after -52s
修复自动化构建缺少依赖的错误
2026-04-17 22:40:02 +08:00

72 lines
2.4 KiB
YAML

name: build
on:
push:
branches:
- main
- master
pull_request:
jobs:
build:
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
include:
- goos: linux
goarch: amd64
binary_name: api
- goos: linux
goarch: arm64
binary_name: api
- goos: windows
goarch: amd64
binary_name: api.exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Verify build
run: |
go build ./cmd/api
go build ./...
- name: Prepare directories
run: |
mkdir -p dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/frontend
mkdir -p dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/docs
mkdir -p dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/submodule
mkdir -p dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/scripts
- name: Build binary
env:
CGO_ENABLED: 0
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
go build -trimpath -ldflags="-s -w" -o dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/${{ matrix.binary_name }} ./cmd/api
- name: Copy runtime files
run: |
cp README.md dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/README.md
cp .env.example dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/.env.example
cp sqldes dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/sqldes
cp -r frontend/. dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/frontend/
cp -r docs/. dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/docs/
cp -r submodule/. dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/submodule/
cp -r scripts/. dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/scripts/
chmod +x dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/scripts/*.sh
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}