From dfa9386ebe694c5e5de321a6f3dc8e2e25149a6b Mon Sep 17 00:00:00 2001 From: jdnjk <2394058778@qq.com> Date: Fri, 23 Aug 2024 21:01:04 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E7=BC=96=E8=AF=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/go.yml | 98 ++++++++++++++++++++++++++++++++-------- 1 file changed, 79 insertions(+), 19 deletions(-) diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index d4c705d..30cd196 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -6,27 +6,87 @@ name: Release Build on: push: branches: [ "master" ] - pull_request: - branches: [ "master" ] + tags: + - '*.*.*' jobs: - build: + strategy: + matrix: + # Include amd64 on all platforms. + goos: [ windows, linux ] + goarch: [ amd64, 386 ] + goamd64: [ v1 ] + exclude: + # Exclude i386 on darwin and dragonfly. + - goarch: 386 + goos: dragonfly + include: + # BEGIN Linux ARM 5 6 7 + - goos: linux + goarch: arm + goarm: 7 + - goos: linux + goarch: arm + goarm: 6 + - goos: linux + goarch: arm + goarm: 5 + # END Linux ARM 5 6 7 + # BEGIN Android ARM 8 + - goos: android + goarch: arm64 + # END Android ARM 8 + # BEGIN Other architectures + # BEGIN riscv64 & ARM64 + - goos: linux + goarch: arm64 + - goos: freebsd + goarch: arm64 + # END Other architectures + runs-on: ubuntu-latest + env: + GOOS: ${{ matrix.goos }} + GOARCH: ${{ matrix.goarch }} + GOARM: ${{ matrix.goarm }} + GOAMD64: ${{ matrix.goamd64 }} + CGO_ENABLED: 0 + BUILD_NAME: AutoInstall-${{ matrix.goos }}-${{ matrix.goarch }}-${{ matrix.goarm }}${{ matrix.goamd64 }}${{ matrix.goos == 'windows' && '.exe' || '' }} + steps: - - uses: actions/checkout@v3 - - - name: 配置Go版本 - uses: actions/setup-go@v4 - with: - go-version: '1.22.2' - - - name: 构建 - run: go build -v ./app.go - - - name: 发布文件 - uses: actions/upload-artifact@v2 - with: - name: Dev Install - path: | - ./app \ No newline at end of file + - uses: actions/checkout@v4 + + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: ^1.20 + check-latest: true + + - name: Build + run: go build app.go + + - name: Upload Build Artifact + uses: actions/upload-artifact@v4 + with: + name: ${{ env.BUILD_NAME }} + path: ${{ env.BUILD_NAME }} + + Publish: + permissions: write-all + if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.version }} + needs: [ build ] + runs-on: ubuntu-latest + steps: + - uses: actions/download-artifact@v4 + with: + path: bin/ + merge-multiple: true + + - name: Upload Release + uses: softprops/action-gh-release@v2 + if: ${{ success() }} + with: + tag_name: ${{ github.event.inputs.version }} + files: bin/* + prerelease: true \ No newline at end of file