Skip to content

Commit 081361f

Browse files
authored
ci(release): switch to v*.*.* tag trigger and add workflow_dispatch (#739)
## Summary - Auto-trigger of `Release` workflow is now scoped to `v*.*.*` tags only. The legacy `gravity-mainnet-*` / `gravity-testnet-*` patterns are dropped — future releases follow a single `v<major>.<minor>.<patch>` track. - Added a `workflow_dispatch` input so a release can be re-run manually from the Actions UI against any existing `v*.*.*` tag (useful for retrying a failed upload or pushing the docker image for a tag whose initial run was interrupted). - Checkout step now follows the dispatched tag when invoked via `workflow_dispatch`; on `push` / `pull_request` it falls back to the default ref. - `Resolve tag` step validates the pattern via a regex (`^v[0-9]+\.[0-9]+\.[0-9]+`) for both push and dispatch paths — accepts `v1.7.0`, `v1.7.0-rc1`, etc., rejects anything that doesn't start with a SemVer-shaped prefix. ## Test plan - [ ] `lint-workflows` (actionlint) passes on this PR. - [ ] PR dry-run path (`if: github.event_name == 'pull_request'`) still runs build + stage assets + docker build (no push). - [ ] After merge to `main`: open Actions → Release → Run workflow → enter a known existing tag (e.g. `v0.5.0`) and confirm the dispatch path resolves the tag, builds, and re-uploads assets to that release with `--clobber`. - [ ] Cut `v1.7.0` via GitHub UI Draft Release → Publish → confirm the push path triggers and the release receives `gravity_node`, `gravity_cli`, their `.sha256` files, and `ghcr.io/galxe/gravity_node:v1.7.0`. ## Notes - `workflow_dispatch` registrations are only visible on the **default branch's** copy of the workflow file. So the UI button will not appear until this is merged into `main`. - This PR does not change the requirement that a GitHub Release must exist before the `gh release upload` step — that contract is unchanged.
1 parent c2db5c0 commit 081361f

1 file changed

Lines changed: 24 additions & 8 deletions

File tree

.github/workflows/release.yml

Lines changed: 24 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,19 @@ name: Release
33
on:
44
push:
55
tags:
6-
- 'gravity-mainnet-*'
7-
- 'gravity-testnet-*'
6+
- 'v*.*.*'
87
pull_request:
98
paths:
109
- '.github/workflows/release.yml'
10+
workflow_dispatch:
11+
inputs:
12+
tag:
13+
description: 'Existing tag to release (must match v*.*.*, e.g. v1.7.0). The tag and its GitHub Release must already exist.'
14+
required: true
15+
type: string
1116

1217
concurrency:
13-
group: release-${{ github.event.pull_request.number || github.ref_name }}
18+
group: release-${{ github.event.pull_request.number || inputs.tag || github.ref_name }}
1419
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1520

1621
permissions:
@@ -45,6 +50,11 @@ jobs:
4550
steps:
4651
- name: Checkout
4752
uses: actions/checkout@v4
53+
with:
54+
# For workflow_dispatch, check out the user-specified tag instead of
55+
# the branch where the dispatch was triggered. For push/PR, fall back
56+
# to the default ref (the tag or PR head).
57+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
4858

4959
- name: Show build environment
5060
# Logs runner OS / glibc / rustc so any future divergence from
@@ -139,13 +149,19 @@ jobs:
139149
id: tag
140150
if: github.event_name != 'pull_request'
141151
shell: bash
152+
env:
153+
INPUT_TAG: ${{ inputs.tag }}
142154
run: |
143155
set -euo pipefail
144-
TAG="${GITHUB_REF##refs/tags/}"
145-
case "$TAG" in
146-
gravity-mainnet-*|gravity-testnet-*) ;;
147-
*) echo "tag must start with gravity-mainnet- or gravity-testnet-: $TAG" >&2; exit 1 ;;
148-
esac
156+
if [ "${GITHUB_EVENT_NAME}" = "workflow_dispatch" ]; then
157+
TAG="$INPUT_TAG"
158+
else
159+
TAG="${GITHUB_REF##refs/tags/}"
160+
fi
161+
if ! echo "$TAG" | grep -Eq '^v[0-9]+\.[0-9]+\.[0-9]+'; then
162+
echo "tag must match v*.*.* (e.g. v1.7.0, v1.7.0-rc1): $TAG" >&2
163+
exit 1
164+
fi
149165
echo "tag=$TAG" >> "$GITHUB_OUTPUT"
150166
151167
- name: Upload assets to GitHub release

0 commit comments

Comments
 (0)