修改文件夹名
Some checks failed
CI Cross-Compile / build (amd64, darwin) (push) Failing after 1m34s
CI Cross-Compile / build (amd64, linux) (push) Failing after 17s
CI Cross-Compile / build (amd64, windows) (push) Failing after 17s

This commit is contained in:
小贺
2025-10-19 18:45:22 +08:00
parent 8ddbcaa5d4
commit f64bcaf40a
2 changed files with 0 additions and 0 deletions

59
.gitea/workflows/ci.yml Normal file
View File

@@ -0,0 +1,59 @@
name: CI Cross-Compile
on:
push:
branches: [ main ]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
goos: [linux, windows, darwin]
goarch: [amd64]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v5
with:
go-version: '1.22.x'
- name: Cache Go build/mod
uses: actions/cache@v4
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}-${{ matrix.goos }}-${{ matrix.goarch }}
restore-keys: |
${{ runner.os }}-go-
- name: Download deps
run: go mod download
- name: Cross-compile (${{ matrix.goos }}/${{ matrix.goarch }})
env:
CGO_ENABLED: "0" # 关闭 cgo便于纯交叉构建
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
run: |
mkdir -p dist/${GOOS}-${GOARCH}
OUT="dist/${GOOS}-${GOARCH}/app"
if [ "${GOOS}" = "windows" ]; then OUT="${OUT}.exe"; fi
# -trimpath/-ldflags 让产物更小更可复现;按你的入口调整 ./cmd/app
go build -trimpath -ldflags="-s -w" -o "${OUT}" ./cmd/app
echo "Built ${OUT}"
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: app-${{ matrix.goos }}-${{ matrix.goarch }}
path: dist/${{ matrix.goos }}-${{ matrix.goarch }}/*
if-no-files-found: error