File tree 2 files changed +59
-3
lines changed
2 files changed +59
-3
lines changed Original file line number Diff line number Diff line change
1
+ name : CI
2
+
3
+ on :
4
+ push :
5
+ paths :
6
+ - ' **.go'
7
+ pull_request :
8
+ workflow_dispatch :
9
+
10
+ env :
11
+ BINARY_PREFIX : " Go-NCMDump_"
12
+ BINARY_SUFFIX : " "
13
+ COMMIT_ID : " ${{ github.sha }}"
14
+ PR_PROMPT : " ::warning:: Build artifact will not be uploaded due to the workflow is trigged by pull request."
15
+
16
+ jobs :
17
+ build :
18
+ name : Build CI
19
+ runs-on : ubuntu-latest
20
+ strategy :
21
+ matrix :
22
+ goos : [linux, windows, darwin]
23
+ goarch : [amd64, arm64]
24
+ fail-fast : true
25
+
26
+ steps :
27
+ - name : Checkout
28
+ uses : actions/checkout@v4
29
+ with :
30
+ submodules : recursive
31
+
32
+ - name : Setup
33
+ uses : actions/setup-go@v5
34
+ with :
35
+ go-version : ' 1.22'
36
+
37
+ - name : Build
38
+ env :
39
+ GOOS : ${{ matrix.goos }}
40
+ GOARCH : ${{ matrix.goarch }}
41
+ IS_PR : ${{ !!github.head_ref }}
42
+ run : |
43
+ if [ $GOOS = "windows" ]; then export BINARY_SUFFIX="$BINARY_SUFFIX.exe"; fi
44
+ if $IS_PR ; then echo $PR_PROMPT; fi
45
+ export BINARY_NAME="$BINARY_PREFIX"$GOOS"_$GOARCH$BINARY_SUFFIX"
46
+ export CGO_ENABLED=0
47
+ export LD_FLAGS="-w -s"
48
+ go build -o "output/$BINARY_NAME" -trimpath -ldflags "$LD_FLAGS" .
49
+
50
+ - name : Upload
51
+ uses : actions/upload-artifact@v4
52
+ if : ${{ !github.head_ref }}
53
+ with :
54
+ name : ${{ matrix.goos }}_${{ matrix.goarch }}
55
+ path : output/
Original file line number Diff line number Diff line change 8
8
jobs :
9
9
goreleaser :
10
10
runs-on : ubuntu-latest
11
+
11
12
steps :
12
13
- name : Checkout
13
- uses : actions/checkout@v2
14
+ uses : actions/checkout@v4
14
15
with :
15
16
submodules : recursive
16
17
17
18
- name : Set up Go
18
- uses : actions/setup-go@v3
19
+ uses : actions/setup-go@v5
19
20
with :
20
21
go-version : ' 1.22'
21
22
22
23
- name : Run GoReleaser
23
- uses : goreleaser/goreleaser-action@v4
24
+ uses : goreleaser/goreleaser-action@v5
24
25
with :
25
26
version : latest
26
27
args : release --clean
You can’t perform that action at this time.
0 commit comments