]> 127.0.0.1 Git - front/.git/commitdiff
Update main.yml
authorqydysky <qydysky@foxmail.com>
Fri, 15 Mar 2024 00:49:31 +0000 (08:49 +0800)
committerGitHub <noreply@github.com>
Fri, 15 Mar 2024 00:49:31 +0000 (08:49 +0800)
.github/workflows/main.yml

index 372fb8938c8729b8e4d78f4356fcced88855c6b6..3c0bbb1fddfa3a01d46ac1220a89826b9bdecb96 100755 (executable)
@@ -17,27 +17,109 @@ on:
       - '**.sum'
 
 jobs:
-
-  build:
-    name: Build
+  u-build:
+    name: build_ubuntu_go${{ matrix.go }}
     runs-on: ubuntu-latest
-    permissions:
-      contents: write
+    strategy:
+      matrix:
+        go: [ '1.22' ]
+    steps:
+    - name: Set up Go${{ matrix.go }}
+      uses: actions/setup-go@v5
+      with:
+        go-version: ${{ matrix.go }}
+
+    - name: Check out code
+      uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
+
+    - name: Build
+      run: |
+        cd main
+        go get .
+        CGO_ENABLED=0 go build -pgo=auto -v -buildmode=exe main.go
+      
+    - name: zip
+      run: zip -q -r ubuntu_go${{ matrix.go }}.zip main
+      
+    - name: Upload a Build Artifact
+      uses: actions/upload-artifact@v4
+      with:
+        name: ubuntu_go${{ matrix.go }}.zip
+        path: ./ubuntu_go${{ matrix.go }}.zip
+        
+  w-build:
+    name: build_windows_go${{ matrix.go }}
+    runs-on: windows-latest
+    strategy:
+      matrix:
+        go: [ '1.22' ]
     steps:
-    - name: Set up Go 1.x
+    - name: Set up Go${{ matrix.go }}
       uses: actions/setup-go@v5
       with:
-        go-version: '1.21'
+        go-version: ${{ matrix.go }}
 
-    - name: Check out code into the Go module directory
+    - name: Check out code
       uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
 
-    - name: Set Release Name
+    - name: Build
       run: |
-        echo "TIME=$(date +"%Y%m%d%H%M%S")" >> $GITHUB_ENV
-        echo "HASH=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_ENV
+        cd main
+        go get .
+        set CGO_ENABLED=0
+        go build -pgo=auto -v -buildmode=exe main.go
+        
+    - name: zip
+      run: .\7za.exe a -r .\windows_go${{ matrix.go }}.zip ./main
+      
+    - name: Upload a Build Artifact
+      uses: actions/upload-artifact@v4
+      with:
+        name: windows_go${{ matrix.go }}.zip
+        path: ./windows_go${{ matrix.go }}.zip
+       
+  mac-build:
+    name: build_macos_go${{ matrix.go }}
+    runs-on: macos-latest
+    strategy:
+      matrix:
+        go: [ '1.22' ]
+    steps:
+    - name: Set up Go${{ matrix.go }}
+      uses: actions/setup-go@v5
+      with:
+        go-version: ${{ matrix.go }}
 
-    - name: Upload a Release Asset
-      uses: softprops/action-gh-release@v1
+    - name: Check out code
+      uses: actions/checkout@v4
+      with:
+        lfs: true
+
+    - name: Checkout LFS objects
+      run: git lfs checkout
+
+    - name: Build
+      run: |
+        cd main
+        go get .
+        set CGO_ENABLED=0
+        go build -pgo=auto -v -buildmode=exe main.go
+        
+    - name: zip
+      run: zip -q -r macos_go${{ matrix.go }}.zip main
+      
+    - name: Upload a Build Artifact
+      uses: actions/upload-artifact@v4
       with:
-        tag_name: v0.1.${{ env.TIME }}
+        name: macos_go${{ matrix.go }}.zip
+        path: ./macos_go${{ matrix.go }}.zip