From 16ef9d7ee3bc30d92ec8c30ba565082be4c48157 Mon Sep 17 00:00:00 2001 From: Adam Bovill Date: Fri, 18 Feb 2022 15:03:33 +1300 Subject: [PATCH] ci(release): adds semantic-release support This shifts the release workflow to run after a successful CI run. It then generates a new semantic version and then runs the go-releaser on that version. --- .github/workflows/release.yml | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5e1ead68..0fec626b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -11,15 +11,20 @@ # name: release on: - push: - tags: - - "v*" + workflow_run: + types: ["completed"] + workflows: ["CI"] + branches: + - main + jobs: goreleaser: runs-on: ubuntu-latest steps: - name: Checkout uses: actions/checkout@v2.3.4 + with: + fetch-depth: 0 - name: Unshallow run: git fetch --prune --unshallow - name: Set up Go @@ -33,6 +38,15 @@ jobs: # These secrets will need to be configured for the repository: GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} PASSPHRASE: ${{ secrets.PASSPHRASE }} + - uses: go-semantic-release/action@v1 + id: release + with: + github-token: ${{ inputs.github-token }} + - name: Fetch Tags + shell: bash + run: | + git fetch --tags + git clean -fd - name: Run GoReleaser uses: goreleaser/goreleaser-action@v2.5.0 with: