|
|
@@ -1,14 +1,14 @@
|
|
1
|
1
|
name: Go Build and Release
|
|
2
|
2
|
|
|
3
|
|
-#on:
|
|
4
|
|
-# push:
|
|
5
|
|
-# tags:
|
|
6
|
|
-# - 'v*.*.*' # 当推送带有版本号的 tag(例如 v1.0.0)时触发工作流
|
|
7
|
3
|
on:
|
|
8
|
4
|
push:
|
|
9
|
|
- branches: [ "master" ]
|
|
10
|
|
- pull_request:
|
|
11
|
|
- branches: [ "master" ]
|
|
|
5
|
+ tags:
|
|
|
6
|
+ - 'v*.*.*' # 当推送带有版本号的 tag(例如 v1.0.0)时触发工作流
|
|
|
7
|
+#on:
|
|
|
8
|
+# push:
|
|
|
9
|
+# branches: [ "master" ]
|
|
|
10
|
+# pull_request:
|
|
|
11
|
+# branches: [ "master" ]
|
|
12
|
12
|
|
|
13
|
13
|
jobs:
|
|
14
|
14
|
build:
|
|
|
@@ -48,10 +48,11 @@ jobs:
|
|
48
|
48
|
mkdir -p release/runtime
|
|
49
|
49
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
50
|
50
|
CC=x86_64-w64-mingw32-gcc GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -o ./release/apimain.exe ./cmd/apimain.go
|
|
51
|
|
- zip -r ${{ matrix.goos}}-${{ matrix.goarch }}.zip ./release
|
|
|
51
|
+ cd release
|
|
|
52
|
+ zip -r ../${{ matrix.goos}}-${{ matrix.goarch }}.zip .
|
|
52
|
53
|
else
|
|
53
|
54
|
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
|
54
|
|
- tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz ./release
|
|
|
55
|
+ tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz -C ./release .
|
|
55
|
56
|
fi
|
|
56
|
57
|
|
|
57
|
58
|
- name: Upload artifact
|
|
|
@@ -67,6 +68,7 @@ jobs:
|
|
67
|
68
|
steps:
|
|
68
|
69
|
- name: Create GitHub Release
|
|
69
|
70
|
uses: softprops/action-gh-release@v2
|
|
|
71
|
+ if: startsWith(github.ref, 'refs/tags/')
|
|
70
|
72
|
with:
|
|
71
|
73
|
files: |
|
|
72
|
74
|
${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz
|