Skip to content

Commit af57388

Browse files
committed
ci: 修复 Build & Release shell 和参数问题
- Windows job 添加 shell: bash 声明 - 移除无效的 -release 参数 - 移除 GOARCH=386 对 go run 的影响 - 合并 Linux 构建为单一 job - Release 添加 master 分支检查 - 简化文件列表为 glob 模式
1 parent b4493d5 commit af57388

1 file changed

Lines changed: 22 additions & 51 deletions

File tree

‎.github/workflows/build-release.yml‎

Lines changed: 22 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ permissions:
1818
contents: write
1919

2020
jobs:
21-
# ── Linux (all non-macOS/non-Windows platforms) ──
21+
# ── Linux: amd64/386/arm/arm64/mips/mipsle + BSDs + Solaris + Plan9 + AIX ──
2222
build-linux:
2323
runs-on: ubuntu-latest
2424
timeout-minutes: 60
@@ -44,40 +44,19 @@ jobs:
4444
HASH=$(git rev-parse --short=8 HEAD)
4545
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_OUTPUT
4646
47-
- name: Build Linux platforms
47+
- name: Build all Linux platforms (with cmount)
4848
run: |
4949
go run bin/cross-compile.go \
50-
-release "${{ steps.ver.outputs.full }}" \
5150
-include '^linux/' \
52-
-exclude '^(linux/386|linux/arm|linux/mips|linux/mipsle|linux/arm-v6|linux/arm-v7)$' \
5351
-tags cmount \
54-
-no-clean \
55-
"${{ steps.ver.outputs.full }}"
56-
57-
- name: Build Linux 386
58-
run: |
59-
GOARCH=386 go run bin/cross-compile.go \
60-
-release "${{ steps.ver.outputs.full }}" \
61-
-include '^linux/386$' \
62-
-tags cmount \
63-
-no-clean \
64-
"${{ steps.ver.outputs.full }}"
65-
66-
- name: Build Linux ARM variants
67-
run: |
68-
go run bin/cross-compile.go \
69-
-release "${{ steps.ver.outputs.full }}" \
70-
-include '^linux/(arm|mips|mipsle)' \
71-
-no-clean \
7252
"${{ steps.ver.outputs.full }}"
7353
7454
- name: Build FreeBSD / NetBSD / OpenBSD / Plan9 / Solaris / AIX
7555
run: |
7656
go run bin/cross-compile.go \
77-
-release "${{ steps.ver.outputs.full }}" \
78-
-exclude '^(windows/|darwin/|linux/)' \
79-
-compile-only \
57+
-include '^(freebsd|netbsd|openbsd|plan9|solaris|aix)' \
8058
-no-clean \
59+
-compile-only \
8160
"${{ steps.ver.outputs.full }}"
8261
8362
- name: Upload Linux artifacts
@@ -95,14 +74,12 @@ jobs:
9574
fail-fast: false
9675
matrix:
9776
include:
98-
- job: amd64
99-
goarch: amd64
100-
build_flags: '-include "^darwin/amd64" -cgo'
101-
- job: arm64
102-
goarch: arm64
103-
build_flags: '-include "^darwin/arm64" -cgo -macos-arch arm64'
104-
105-
name: macOS ${{ matrix.job }}
77+
- name: amd64
78+
flags: '-include "^darwin/amd64" -cgo'
79+
- name: arm64
80+
flags: '-include "^darwin/arm64" -cgo -macos-arch arm64'
81+
82+
name: macOS ${{ matrix.name }}
10683
steps:
10784
- uses: actions/checkout@v6
10885
with:
@@ -131,16 +108,14 @@ jobs:
131108
- name: Build
132109
run: |
133110
go run bin/cross-compile.go \
134-
-release "${{ steps.ver.outputs.full }}" \
135-
${{ matrix.build_flags }} \
111+
${{ matrix.flags }} \
136112
-tags cmount \
137-
-no-clean \
138113
"${{ steps.ver.outputs.full }}"
139114
140115
- name: Upload macOS artifacts
141116
uses: actions/upload-artifact@v7
142117
with:
143-
name: binaries-macos-${{ matrix.job }}
118+
name: binaries-macos-${{ matrix.name }}
144119
path: build/*
145120
retention-days: 7
146121

@@ -159,26 +134,24 @@ jobs:
159134
check-latest: true
160135

161136
- name: Install WinFsp and zip
162-
shell: powershell
163137
run: |
164-
$ProgressPreference = 'SilentlyContinue'
165138
choco install -y winfsp zip
166-
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
139+
echo "CPATH=C:\Program Files\WinFsp\inc\fuse;C:\Program Files (x86)\WinFsp\inc\fuse" >> $env:GITHUB_ENV
167140
168141
- name: Set version
169142
id: ver
143+
shell: bash
170144
run: |
171145
UPSTREAM=$(cat VERSION)
172146
HASH=$(git rev-parse --short=8 HEAD)
173-
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_ENV
147+
echo "full=${UPSTREAM}-${HASH}" >> $GITHUB_OUTPUT
174148
175149
- name: Build Windows
150+
shell: bash
176151
run: |
177-
go run bin/cross-compile.go `
178-
-release "${{ steps.ver.outputs.full }}" `
179-
-include '^windows/' `
180-
-tags cmount `
181-
-no-clean `
152+
go run bin/cross-compile.go \
153+
-include '^windows/' \
154+
-tags cmount \
182155
"${{ steps.ver.outputs.full }}"
183156
184157
- name: Upload Windows artifacts
@@ -197,7 +170,7 @@ jobs:
197170
steps:
198171
- uses: actions/checkout@v6
199172

200-
- name: Set version
173+
- name: Set release version
201174
id: ver
202175
run: |
203176
UPSTREAM=$(cat VERSION)
@@ -212,9 +185,7 @@ jobs:
212185
merge-multiple: true
213186

214187
- name: List release files
215-
run: |
216-
echo "Files to release:"
217-
find release-artifacts -type f | sort
188+
run: find release-artifacts -type f | sort
218189

219190
- name: Create Release
220191
uses: softprops/action-gh-release@v2
@@ -236,6 +207,6 @@ jobs:
236207
draft: false
237208
prerelease: false
238209
files: |
239-
release-artifacts/*
210+
release-artifacts/**/*
240211
env:
241212
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

0 commit comments

Comments
 (0)