From 0e61bab18591acb0248c577fbdeededd9eaa5ee7 Mon Sep 17 00:00:00 2001 From: John Kjell Date: Thu, 26 Oct 2023 22:55:04 -0500 Subject: [PATCH] Add release job to pipeline Signed-off-by: John Kjell --- .github/workflows/pipeline.yml | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 306f6cc1..305512c2 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -41,6 +41,7 @@ jobs: command: go vet ./... test: + needs: [fmt, static_analysis] uses: ./.github/workflows/witness.yml with: pull_request: ${{ github.event_name == 'pull_request' }} @@ -56,3 +57,38 @@ jobs: step: "e2e" attestations: "github" command: ./test/test.sh + + release: + permissions: + id-token: write + contents: write + packages: write + runs-on: ubuntu-latest + needs: test + if: github.event_name == 'push' && contains(github.ref, 'refs/tags/') + + steps: + - uses: actions/checkout@v4.1.1 + - uses: actions/setup-go@v4.1.0 + with: + go-version: 1.21.x + + - name: Login to GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Download GoReleaser + run: go install github.com/goreleaser/goreleaser@latest + + - name: Run GoReleaser + uses: testifysec/witness-run-action@40aa4ef36fc431a37de7c3faebcb66513c03b934 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + GITHUB_REPOSITORY_OWNER: ${{ github.repository_owner }} + with: + step: "build" + attestations: "github" + command: goreleaser release --clean \ No newline at end of file