File tree Expand file tree Collapse file tree 1 file changed +63
-0
lines changed
Expand file tree Collapse file tree 1 file changed +63
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build
2+
3+ on :
4+ workflow_dispatch :
5+ inputs :
6+ choice :
7+ type : choice
8+ required : true
9+ options :
10+ - " Artifact"
11+ - " Release"
12+ version :
13+ type : string
14+ required : false
15+
16+ jobs :
17+ build :
18+ strategy :
19+ matrix :
20+ os : [linux, windows, darwin]
21+ arch : [amd64, arm64]
22+ runs-on : ubuntu-24.04
23+ steps :
24+ - uses : actions/checkout@v4
25+ - uses : actions/setup-go@v5
26+ with :
27+ go-version : ' 1.24'
28+ check-latest : true
29+ - name : Build
30+ run : |
31+ go build -ldflags="-s"
32+ env :
33+ GOOS : ${{ matrix.os }}
34+ GOARCH : ${{ matrix.arch }}
35+ - uses : actions/upload-artifact@v4
36+ with :
37+ name : icns-encoder-${{ matrix.os }}-${{ matrix.arch }}
38+ path : ./icns-encoder*
39+
40+ release :
41+ if : github.event.inputs.choice == 'Release'
42+ runs-on : ubuntu-24.04
43+ needs : [build]
44+ steps :
45+ - uses : actions/download-artifact@v4
46+ with :
47+ pattern : icns-encoder-*
48+ path : artifacts
49+ - name : Rename
50+ run : |
51+ mkdir ./outputs
52+ find ./artifacts -type f | while read file; do
53+ ext="${file##*.}"
54+ artifact_name=$(basename "$(dirname "$file")")
55+ [ "$ext" != "$file" ] && new_name="$artifact_name.$ext" || new_name="$artifact_name"
56+ mv "$file" "./outputs/$new_name"
57+ done
58+ - uses : softprops/action-gh-release@v2
59+ with :
60+ name : Release ${{ github.event.inputs.version }}
61+ tag_name : ${{ github.event.inputs.version }}
62+ files : |
63+ ./outputs/*
You can’t perform that action at this time.
0 commit comments