Files
SingBox-Gopanel/.gitea/workflows/build.yml
CN-JS-HuiBai e8e7664aff
All checks were successful
build / build (api, amd64, linux) (push) Successful in -15s
build / build (api, arm64, linux) (push) Successful in -29s
build / build (api.exe, amd64, windows) (push) Successful in -27s
软件功能基本开发完成,内测BUG等待修复
2026-04-17 22:31:09 +08:00

68 lines
2.0 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
- 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 scripts/install.sh dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/install.sh
chmod +x dist/singbox-gopanel-${{ matrix.goos }}-${{ matrix.goarch }}/install.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 }}