Browse Source

up build docker

ljw 1 year ago
parent
commit
38bda17271
1 changed files with 16 additions and 16 deletions
  1. 16 16
      .github/workflows/build.yml

+ 16 - 16
.github/workflows/build.yml

@@ -52,7 +52,7 @@ jobs:
52
           swag init -g cmd/apimain.go --output docs/api --instanceName api --exclude http/controller/admin
52
           swag init -g cmd/apimain.go --output docs/api --instanceName api --exclude http/controller/admin
53
           swag init -g cmd/apimain.go --output docs/admin --instanceName admin --exclude http/controller/api
53
           swag init -g cmd/apimain.go --output docs/admin --instanceName admin --exclude http/controller/api
54
 
54
 
55
-      - name: Build for ${{ matrix.goos }}-${{ matrix.goarch }}
55
+      - name: Build for ${{ matrix.job.goos }}-${{ matrix.job.platform }}
56
         run: |
56
         run: |
57
           mkdir release -p
57
           mkdir release -p
58
           cp -ar resources release/
58
           cp -ar resources release/
@@ -60,41 +60,41 @@ jobs:
60
           cp -ar conf release/
60
           cp -ar conf release/
61
           mkdir -p release/data
61
           mkdir -p release/data
62
           mkdir -p release/runtime
62
           mkdir -p release/runtime
63
-          if [ "${{ matrix.goos }}" = "windows" ]; then
63
+          if [ "${{ matrix.job.goos }}" = "windows" ]; then
64
             sudo apt-get install gcc-mingw-w64-x86-64 zip -y
64
             sudo apt-get install gcc-mingw-w64-x86-64 zip -y
65
-            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
66
-            zip -r ${{ matrix.goos}}-${{ matrix.goarch }}.zip ./release
65
+            GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=x86_64-w64-mingw32-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain.exe ./cmd/apimain.go
66
+            zip -r ${{ matrix.job.goos}}-${{ matrix.job.platform }}.zip ./release
67
           else
67
           else
68
-            if [ "${{ matrix.platform }}" = "arm64v8" ]; then
68
+            if [ "${{ matrix.job.platform }}" = "arm64v8" ]; then
69
                 wget https://musl.cc/aarch64-linux-musl-cross.tgz
69
                 wget https://musl.cc/aarch64-linux-musl-cross.tgz
70
                 tar -xvzf aarch64-linux-musl-cross.tgz
70
                 tar -xvzf aarch64-linux-musl-cross.tgz
71
                 export PATH=$PATH:$PWD/aarch64-linux-musl-cross/bin
71
                 export PATH=$PATH:$PWD/aarch64-linux-musl-cross/bin
72
-                GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} CC=aarch64-linux-musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
72
+                GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=aarch64-linux-musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
73
             else
73
             else
74
               sudo apt-get install musl musl-dev musl-tools -y
74
               sudo apt-get install musl musl-dev musl-tools -y
75
-              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
75
+              GOOS=${{ matrix.job.goos }} GOARCH=${{ matrix.job.platform }} CC=musl-gcc CGO_LDFLAGS="-static" CGO_ENABLED=1 go build -ldflags "-s -w" -o ./release/apimain ./cmd/apimain.go
76
             fi
76
             fi
77
-            tar -czf ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz ./release
77
+            tar -czf ${{ matrix.job.goos}}-${{ matrix.job.platform }}.tar.gz ./release
78
           fi
78
           fi
79
 
79
 
80
       - name: Upload artifact
80
       - name: Upload artifact
81
         uses: actions/upload-artifact@v4
81
         uses: actions/upload-artifact@v4
82
         with:
82
         with:
83
-          name: rustdesk-api-${{ matrix.goos }}-${{ matrix.goarch }}
83
+          name: rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }}
84
           path: |
84
           path: |
85
-            ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz
86
-            ${{ matrix.goos}}-${{ matrix.goarch }}.zip
85
+            ${{ matrix.job.goos}}-${{ matrix.job.platform }}.tar.gz
86
+            ${{ matrix.job.goos}}-${{ matrix.job.platform }}.zip
87
 
87
 
88
       - name: Upload to GitHub Release
88
       - name: Upload to GitHub Release
89
         uses: softprops/action-gh-release@v2
89
         uses: softprops/action-gh-release@v2
90
         with:
90
         with:
91
           files: |
91
           files: |
92
-            ${{ matrix.goos}}-${{ matrix.goarch }}.tar.gz
93
-            ${{ matrix.goos}}-${{ matrix.goarch }}.zip
92
+            ${{ matrix.job.goos}}-${{ matrix.job.platform }}.tar.gz
93
+            ${{ matrix.job.goos}}-${{ matrix.job.platform }}.zip
94
         env:
94
         env:
95
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
95
           GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
96
   docker:
96
   docker:
97
-    name: Push Docker Image ${{ matrix.platform }}
97
+    name: Push Docker Image ${{ matrix.job.platform }}
98
     needs: build
98
     needs: build
99
     runs-on: ubuntu-latest
99
     runs-on: ubuntu-latest
100
     strategy:
100
     strategy:
@@ -120,13 +120,13 @@ jobs:
120
       - name: Download binaries
120
       - name: Download binaries
121
         uses: actions/download-artifact@v3
121
         uses: actions/download-artifact@v3
122
         with:
122
         with:
123
-          name: rustdesk-api-${{ matrix.goos }}-${{ matrix.goarch }}
123
+          name: rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }}
124
           path: ./
124
           path: ./
125
 
125
 
126
       - name: Unzip binaries
126
       - name: Unzip binaries
127
         run: |
127
         run: |
128
           mkdir release -p
128
           mkdir release -p
129
-          tar -xzf rustdesk-api-${{ matrix.goos }}-${{ matrix.goarch }}.tar.gz -C release/
129
+          tar -xzf rustdesk-api-${{ matrix.job.goos }}-${{ matrix.job.platform }}.tar.gz -C release/
130
 
130
 
131
       - name: Build and push Docker image
131
       - name: Build and push Docker image
132
         uses: docker/build-push-action@v5
132
         uses: docker/build-push-action@v5