diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 25484fd..34a0a59 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,11 +3,18 @@ name: Release on: push: branches: [main] + # Re-run GoReleaser for an existing release tag (e.g. after a failed run). + workflow_dispatch: + inputs: + tag: + description: Existing release tag, e.g. v0.1.0 + required: true permissions: {} jobs: release-please: + if: github.event_name == 'push' runs-on: ubuntu-latest permissions: contents: write @@ -25,8 +32,10 @@ jobs: # Runs in the same workflow: tags pushed with GITHUB_TOKEN trigger no other workflows. goreleaser: needs: release-please - if: needs.release-please.outputs.created == 'true' + if: ${{ !cancelled() && (needs.release-please.outputs.created == 'true' || github.event_name == 'workflow_dispatch') }} runs-on: ubuntu-latest + env: + RELEASE_TAG: ${{ inputs.tag || needs.release-please.outputs.tag }} permissions: contents: write # upload release assets packages: write # push to GHCR @@ -35,7 +44,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: - ref: ${{ needs.release-please.outputs.tag }} + ref: ${{ env.RELEASE_TAG }} fetch-depth: 0 persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 @@ -55,6 +64,8 @@ jobs: args: release --clean env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # Explicit, in case several tags point at the release commit. + GORELEASER_CURRENT_TAG: ${{ env.RELEASE_TAG }} HOMEBREW_TAP_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} - uses: actions/attest-build-provenance@4d101475d8b20a2381f78447822ac1eab6504dd8 # v4.2.2 with: diff --git a/release-please-config.json b/release-please-config.json index 7e06e1b..fe70e96 100644 --- a/release-please-config.json +++ b/release-please-config.json @@ -7,6 +7,7 @@ "initial-version": "0.1.0", "bump-minor-pre-major": true, "bump-patch-for-minor-pre-major": false, + "include-component-in-tag": false, "include-v-in-tag": true, "changelog-sections": [ { "type": "feat", "section": "Features" },