Files
SingBox-Gopanel/.gitea/workflows/build.yml
CN-JS-HuiBai d237d80eec
Some checks failed
build / build (api, amd64, linux) (push) Failing after -56s
build / build (api, arm64, linux) (push) Failing after -57s
build / build (api.exe, amd64, windows) (push) Failing after -57s
IPv6 订阅流程锁定
2026-04-18 10:11:31 +08:00

71 lines
2.3 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 -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 }}