From a8e373a5f291cd3d73f1df8e10901677aa9fd9e8 Mon Sep 17 00:00:00 2001 From: Dylan Arbour Date: Mon, 1 Apr 2024 23:00:08 -0400 Subject: [PATCH] Run GoReleaser on pull-requests and main To ensure that the GoReleaser configuration is correct, run the binary build on every pull-request and commit, but only actually release on tags. --- .github/workflows/ci.yml | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ec1cbd..c25c46f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,10 +33,9 @@ jobs: - run: go build . - run: ./git-get github.com/arbourd/git-get - release: - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest + bin: needs: [test] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -45,12 +44,20 @@ jobs: - uses: actions/setup-go@v5 with: go-version-file: go.mod + cache: true + - run: go mod download - - name: Run GoReleaser - uses: goreleaser/goreleaser-action@v5 + - uses: goreleaser/goreleaser-action@v5 with: version: latest - args: release --clean + install-only: true + + - if: ${{ !startsWith(github.ref, 'refs/tags/v') }} + run: goreleaser release --clean --snapshot + + # Release binaries on release tags + - if: startsWith(github.ref, 'refs/tags/v') + run: goreleaser release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} HOMEBREW_TAP_GITHUB_TOKEN: ${{ secrets.HOMEBREW_TAP_GITHUB_TOKEN }}