|
|
@@ -1,4 +1,4 @@
|
|
1
|
|
-name: Go Build and Release
|
|
|
1
|
+name: Build and Release
|
|
2
|
2
|
|
|
3
|
3
|
on:
|
|
4
|
4
|
push:
|
|
|
@@ -27,14 +27,34 @@ jobs:
|
|
27
|
27
|
uses: actions/setup-go@v4
|
|
28
|
28
|
with:
|
|
29
|
29
|
go-version: '1.22' # 选择 Go 版本
|
|
30
|
|
- - name: install gcc zip
|
|
|
30
|
+
|
|
|
31
|
+ - name: Set up npm
|
|
|
32
|
+ uses: actions/setup-node@v2
|
|
|
33
|
+ with:
|
|
|
34
|
+ node-version: '20'
|
|
|
35
|
+ cache: 'npm'
|
|
|
36
|
+
|
|
|
37
|
+ - name: install gcc zip musl
|
|
31
|
38
|
run: |
|
|
32
|
39
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
33
|
40
|
sudo apt-get install gcc-mingw-w64-x86-64 zip -y
|
|
|
41
|
+ else
|
|
|
42
|
+ sudo apt-get install musl musl-dev musl-tools -y
|
|
34
|
43
|
fi
|
|
35
|
44
|
|
|
|
45
|
+
|
|
|
46
|
+ - name: build rustdesk-api-web
|
|
|
47
|
+ run: |
|
|
|
48
|
+ git clone https://github.com/lejianwen/rustdesk-api-web
|
|
|
49
|
+ cd rustdesk-api-web
|
|
|
50
|
+ npm install
|
|
|
51
|
+ npm run build
|
|
|
52
|
+ cp -ar dist/* ../resources/admin/
|
|
|
53
|
+
|
|
36
|
54
|
- name: tidy
|
|
37
|
55
|
run: go mod tidy
|
|
|
56
|
+
|
|
|
57
|
+
|
|
38
|
58
|
- name: swag
|
|
39
|
59
|
run: |
|
|
40
|
60
|
go install github.com/swaggo/swag/cmd/swag@latest
|
|
|
@@ -50,10 +70,10 @@ jobs:
|
|
50
|
70
|
mkdir -p release/data
|
|
51
|
71
|
mkdir -p release/runtime
|
|
52
|
72
|
if [ "${{ matrix.goos }}" = "windows" ]; then
|
|
53
|
|
- CC=x86_64-w64-mingw32-gcc GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_ENABLED=1 go build -o ./release/apimain.exe ./cmd/apimain.go
|
|
|
73
|
+ GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain.exe ./cmd/apimain.go
|
|
54
|
74
|
zip -r ${{ matrix.goos}}-${{ matrix.goarch }}.zip ./release
|
|
55
|
75
|
else
|
|
56
|
|
- GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
|
|
76
|
+ GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
|
|
57
|
77
|
tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz ./release
|
|
58
|
78
|
fi
|
|
59
|
79
|
|