From 48a6be6913e588df7c14c5b8e7129fae5c800f1b Mon Sep 17 00:00:00 2001 From: LTLA Date: Thu, 15 Feb 2024 22:38:08 -0800 Subject: [PATCH] Added separate action to publish versioned binaries. Also cleaned up the existing action to avoid unnecessary runs. --- .github/workflows/build.yaml | 13 +++++++++++-- .github/workflows/publish.yaml | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/publish.yaml diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index bc537f8..a012b38 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,10 +1,18 @@ -name: Test and build Go +name: Unit tests on: push: branches: - master + paths: + - '**.go' + - 'go.**' + - .github/workflows/build.yaml pull_request: + paths: + - '**.go' + - 'go.**' + - .github/workflows/build.yaml jobs: test: @@ -39,7 +47,8 @@ jobs: - name: Check out uses: actions/checkout@v4 - - uses: wangyoucao577/go-release-action@v1 + - name: Build latest + uses: wangyoucao577/go-release-action@v1 with: github_token: ${{ secrets.GITHUB_TOKEN }} goos: ${{ matrix.os }} diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml new file mode 100644 index 0000000..8828435 --- /dev/null +++ b/.github/workflows/publish.yaml @@ -0,0 +1,32 @@ +name: Publish version + +on: + push: + tags: + - "*" + +jobs: + publish: + runs-on: ubuntu-latest + strategy: + matrix: + os: [ linux, darwin ] + arch: [ amd64, arm64 ] + + steps: + - name: Check out + uses: actions/checkout@v4 + + - name: Create release + uses: softprops/action-gh-release@v1 + + - name: Publish binaries + uses: wangyoucao577/go-release-action@v1 + with: + github_token: ${{ secrets.GITHUB_TOKEN }} + goos: ${{ matrix.os }} + goarch: ${{ matrix.arch }} + release_tag: ${{ github.ref_name }} + asset_name: gobbler-${{ matrix.os }}-${{ matrix.arch }} + overwrite: true + compress_assets: false