Skip to content

Commit 27f287d

Browse files
authored
ci: add workflow_dispatch tag input for release re-runs (#215)
Adds an optional 'tag' input to the release workflow's workflow_dispatch trigger, enabling re-releases of existing tags from the Actions UI. When a tag is provided: - Release Please is skipped (unnecessary for re-releases) - The release job runs using the specified tag - All downstream jobs (Helm, SLSA provenance, OperatorHub) run normally The existing 'Clean existing release assets' step ensures idempotent re-runs by removing old assets before uploading new ones. This enables recovery from partial release failures (like the v0.1.12 SBOM signing failure) without deleting tags or creating new releases. Signed-off-by: Sebastien Tardif <sebtardif@ncf.ca>
1 parent afc6026 commit 27f287d

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

.github/workflows/release.yaml

Lines changed: 16 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,12 @@ name: Release
33
on:
44
push:
55
branches: [main]
6-
workflow_dispatch: {}
6+
workflow_dispatch:
7+
inputs:
8+
tag:
9+
description: "Re-release an existing tag (e.g., v0.1.12). Leave empty for normal release-please flow."
10+
required: false
11+
type: string
712

813
concurrency:
914
group: release-${{ github.ref }}
@@ -25,7 +30,8 @@ jobs:
2530
# do not trigger separate tag-push workflows.
2631
release-please:
2732
name: Release Please
28-
if: github.event_name == 'push' || github.event_name == 'workflow_dispatch'
33+
# Skip release-please when manually re-releasing an existing tag.
34+
if: inputs.tag == '' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch')
2935
runs-on: ubuntu-latest
3036
timeout-minutes: 10
3137
permissions:
@@ -56,15 +62,17 @@ jobs:
5662
release:
5763
name: Release
5864
needs: [release-please]
59-
# Run when release-please created a release, OR on manual workflow_dispatch
60-
# with a tag ref. always() is needed because release-please is skipped on
65+
# Run when release-please created a release, on manual workflow_dispatch
66+
# with a tag ref, or when re-releasing via the tag input.
67+
# always() is needed because release-please is skipped on
6168
# workflow_dispatch, which would otherwise skip this job too.
6269
if: |-
6370
always() &&
6471
!failure() &&
6572
!cancelled() &&
6673
(needs.release-please.outputs.release_created == 'true' ||
67-
(github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/')))
74+
(github.event_name == 'workflow_dispatch' && startsWith(github.ref, 'refs/tags/')) ||
75+
(github.event_name == 'workflow_dispatch' && inputs.tag != ''))
6876
runs-on: ubuntu-latest
6977
timeout-minutes: 30
7078
environment: release
@@ -86,8 +94,9 @@ jobs:
8694
id: tag
8795
shell: bash
8896
run: |
89-
# On release-please: use its output. On workflow_dispatch: use the ref.
90-
TAG="${{ needs.release-please.outputs.tag_name || github.ref_name }}"
97+
# On release-please: use its output. On re-release: use the input tag.
98+
# On workflow_dispatch with tag ref: use ref_name.
99+
TAG="${{ needs.release-please.outputs.tag_name || inputs.tag || github.ref_name }}"
91100
echo "name=${TAG}" >> "$GITHUB_OUTPUT"
92101
echo "Releasing: ${TAG}"
93102

0 commit comments

Comments
 (0)