From e24e777bbb52262b6616d7fa3a9133ff2fe472e0 Mon Sep 17 00:00:00 2001 From: qydysky Date: Fri, 15 Mar 2024 08:49:31 +0800 Subject: [PATCH] Update main.yml --- .github/workflows/main.yml | 110 ++++++++++++++++++++++++++++++++----- 1 file changed, 96 insertions(+), 14 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 372fb89..3c0bbb1 100755 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 -- 2.39.2