chore(ci): 优化 GitHub Actions 构建流程

- 强制指定使用 bash shell,解决 Windows 环境下的执行错误
- 在构建前运行 go mod tidy,确保依赖整洁
- 保留编译过程中的控制台输出,便于调试追踪
This commit is contained in:
coolxitech
2025-12-13 17:06:31 +08:00
parent 67012cb273
commit 790c1b5840

View File

@@ -73,11 +73,16 @@ jobs:
env:
GOOS: ${{ matrix.goos }}
GOARCH: ${{ matrix.goarch }}
shell: bash # 强制指定使用 bash解决 Windows 下的语法错误
run: |
# 初始化 go.mod (如果不存在)
if [ ! -f go.mod ]; then
go mod init ogame-app
fi
# 整理依赖(确保编译环境干净)
go mod tidy
# 编译命令,保留控制台
go build -ldflags="-s -w" -o ${{ matrix.executable }} main.go