99 build :
1010 strategy :
1111 matrix :
12- os : [ubuntu-latest, windows-latest]
12+ include :
13+ - os : ubuntu-latest
14+ goos : linux
15+ goarch : amd64
16+ - os : ubuntu-latest
17+ goos : linux
18+ goarch : arm64
19+ - os : macos-latest
20+ goos : darwin
21+ goarch : amd64
22+ - os : macos-latest
23+ goos : darwin
24+ goarch : arm64
25+ - os : windows-latest
26+ goos : windows
27+ goarch : amd64
28+ - os : windows-latest
29+ goos : windows
30+ goarch : arm64
31+ - os : windows-latest
32+ goos : windows
33+ goarch : 386
1334 runs-on : ${{ matrix.os }}
1435 permissions :
1536 contents : write
@@ -21,21 +42,18 @@ jobs:
2142 with :
2243 go-version : ' 1.22'
2344
24- - name : Build Linux
25- if : matrix.os == 'ubuntu-latest'
26- run : GOOS=linux go build -ldflags "-s -w" -o mhr-cfw-go-linux ./cmd/mhr-cfw
45+ - name : Build
46+ run : GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build -ldflags "-s -w" -o mhr-cfw-go-${{ matrix.goos }}-${{ matrix.goarch }} ./cmd/mhr-cfw
2747
28- - name : Build Windows
29- if : matrix.os == 'windows-latest '
30- run : go build -ldflags "-s -w" -o mhr-cfw-go-windows.exe ./cmd/mhr-cfw
48+ - name : Rename Windows executable
49+ if : matrix.goos == 'windows'
50+ run : Move-Item mhr-cfw-go-windows-${{ matrix.goarch }} mhr-cfw-go-windows-${{ matrix.goarch }}.exe
3151
3252 - name : Upload artifact
3353 uses : actions/upload-artifact@v4
3454 with :
35- name : mhr-cfw-go-${{ matrix.os }}
36- path : |
37- mhr-cfw-go-windows.exe
38- mhr-cfw-go-linux
55+ name : mhr-cfw-go-${{ matrix.goos }}-${{ matrix.goarch }}
56+ path : mhr-cfw-go-${{ matrix.goos }}-${{ matrix.goarch }}*
3957
4058 release :
4159 needs : build
@@ -46,24 +64,18 @@ jobs:
4664 steps :
4765 - uses : actions/checkout@v4
4866
49- - name : Download Linux artifact
67+ - name : Download all artifacts
5068 uses : actions/download-artifact@v4
5169 with :
52- name : mhr-cfw-go-ubuntu-latest
5370 path : .
5471
55- - name : Download Windows artifact
56- uses : actions/download-artifact@v4
57- with :
58- name : mhr-cfw-go-windows-latest
59- path : .
72+ - name : List artifacts
73+ run : Get-ChildItem -Recurse -File | Select-Object -ExpandProperty FullName
6074
6175 - name : Release
6276 uses : softprops/action-gh-release@v2
6377 with :
64- files : |
65- mhr-cfw-go-windows.exe
66- mhr-cfw-go-linux
78+ files : mhr-cfw-go-*
6779 body : " Built from commit ${{ github.sha }}"
6880 env :
69- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
81+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments