File tree 5 files changed +123
-7
lines changed
5 files changed +123
-7
lines changed Original file line number Diff line number Diff line change
1
+ name : Release
2
+
3
+ on :
4
+ push :
5
+ tags : ["*"]
6
+
7
+ jobs :
8
+ release :
9
+ strategy :
10
+ matrix :
11
+ include :
12
+ - os : ubuntu-latest
13
+ lower_os : linux
14
+ asset_name : bqls_linux_amd64
15
+ - os : macos-latest
16
+ lower_os : macos
17
+ asset_name : bqls_darwin_amd64
18
+ name : Release Go Binary
19
+ runs-on : ${{ matrix.os }}
20
+ env :
21
+ BIN_NAME : bqls
22
+
23
+ steps :
24
+ - uses : actions/checkout@v3
25
+ with :
26
+ fetch-depth : 0
27
+
28
+ - name : setup Go
29
+ uses : actions/setup-go@v4
30
+ with :
31
+ go-version-file : go.mod
32
+ cache : true
33
+
34
+ - name : cache for linux
35
+ uses : actions/cache@v3
36
+ if : runner.os == 'Linux'
37
+ with :
38
+ path : |
39
+ ~/.cache/go-build
40
+ ~/go/pkg/mod
41
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
42
+ restore-keys : |
43
+ ${{ runner.os }}-go-
44
+
45
+ - name : cache for macOS
46
+ uses : actions/cache@v3
47
+ if : runner.os == 'macOS'
48
+ with :
49
+ path : |
50
+ ~/Library/Caches/go-build
51
+ ~/go/pkg/mod
52
+ key : ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
53
+ restore-keys : |
54
+ ${{ runner.os }}-go-
55
+
56
+ - name : download modules
57
+ run : |
58
+ go mod download
59
+
60
+ - uses : rui314/setup-mold@v1
61
+
62
+ - name : Set tag to environment variable
63
+ id : set-tag
64
+ run : echo ::set-output name=version::${GITHUB_REF#refs/*/}
65
+
66
+ - name : build
67
+ run : mkdir ./build && go build -o ./build/bqls -ldflags '-s -w -X main.version=${{ steps.set-tag.outputs.version }}' .
68
+ env :
69
+ CC : clang
70
+ CXX : clang++
71
+
72
+ - name : Zip binaries
73
+ run : |
74
+ cd build
75
+ zip ${{ matrix.asset_name }}.zip bqls
76
+ ls -lR ./
77
+ cd ../
78
+
79
+ - id : lowerCaseOS
80
+ run : INPUT=${{ runner.os }} echo "::set-output name=os::${INPUT,,}"
81
+
82
+ - uses : goreleaser/goreleaser-action@v2
83
+ with :
84
+ version : latest
85
+ args : release --config=./.goreleaser-${{ matrix.lower_os }}.yml --clean
86
+ env :
87
+ GITHUB_TOKEN : ${{ secrets.ACCESS_TOKEN }}
Original file line number Diff line number Diff line change 8
8
jobs :
9
9
build :
10
10
name : Build
11
- strategy :
12
- matrix :
13
- os : [ "ubuntu-latest" ]
14
- go-version : [ "1.20" ]
15
- runs-on : ${{ matrix.os }}
11
+ runs-on : ubuntu-latest
16
12
steps :
17
13
- name : checkout
18
14
uses : actions/checkout@v3
19
- - name : setup Go ${{ matrix.go-version }}
15
+ - name : setup Go
20
16
uses : actions/setup-go@v4
21
17
with :
22
- go-version : ${{ matrix.go-version }}
18
+ go-version-file : go.mod
23
19
cache : true
24
20
- name : cache for linux
25
21
uses : actions/cache@v3
Original file line number Diff line number Diff line change
1
+ build /
Original file line number Diff line number Diff line change
1
+ builds :
2
+ - binary : bqls
3
+ skip : true
4
+ - goos :
5
+ - linux
6
+ goarch :
7
+ - amd64
8
+ ldflags :
9
+ - -X main.version={{ .Version }}
10
+ - -X main.revision={{ .ShortCommit }}
11
+
12
+ release :
13
+ github :
14
+ owner : kitagry
15
+ name : bqls
16
+ extra_files :
17
+ - glob : " build/*.zip"
Original file line number Diff line number Diff line change
1
+ builds :
2
+ - goos :
3
+ - darwin
4
+ goarch :
5
+ - amd64
6
+ ldflags :
7
+ - -X main.version={{ .Version }}
8
+ - -X main.revision={{ .ShortCommit }}
9
+
10
+ release :
11
+ github :
12
+ owner : kitagry
13
+ name : bqls
14
+ extra_files :
15
+ - glob : " build/*.zip"
You can’t perform that action at this time.
0 commit comments