fix(release): use single stamp step for both push and dispatch triggers
CI / cargo fmt --check (push) Successful in 25s
CI / cargo clippy (push) Successful in 28s
CI / cargo test (push) Successful in 37s

This commit is contained in:
gffranco
2026-06-24 01:29:44 +00:00
parent d293e6b5b6
commit 84d3b03485
+17 -14
View File
@@ -29,8 +29,8 @@ jobs:
name: bump + tag
runs-on: ubuntu-latest
outputs:
version: ${{ steps.tag.outputs.tag_prefix }}
tag: ${{ steps.tag.outputs.tag_full }}
version: ${{ steps.stamp.outputs.version }}
tag: ${{ steps.stamp.outputs.tag }}
steps:
- uses: actions/checkout@v4
with:
@@ -49,21 +49,21 @@ jobs:
restore-keys: |
${{ runner.os }}-cargo-prepare-
- name: Extract version from tag (push trigger)
if: github.event_name == 'push'
id: tag
run: |
echo "tag_prefix=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
echo "tag=${GITHUB_REF_NAME}" >> "$GITHUB_OUTPUT"
- name: Validate version + stamp
if: github.event_name == 'workflow_dispatch'
- name: Stamp version + tag
id: stamp
env:
VERSION: ${{ inputs.version }}
run: |
set -euo pipefail
ver="${VERSION#v}" # tolerate a leading v
if [ "${GITHUB_EVENT_NAME}" = "push" ]; then
# Tag push from local: tag already exists, just verify + extract version
tag="${GITHUB_REF_NAME}"
ver="${tag#v}"
if ! printf '%s' "$ver" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?$'; then
echo "::error::'$ver' is not a semver version (expected e.g. 0.4.0)"
exit 1
fi
else
# Manual dispatch: validate input, stamp, verify tag doesn't exist yet
ver="${VERSION#v}"
if ! printf '%s' "$ver" | grep -Eq '^[0-9]+\.[0-9]+\.[0-9]+([-.][0-9A-Za-z.-]+)?$'; then
echo "::error::'$ver' is not a semver version (expected e.g. 0.4.0)"
exit 1
@@ -75,8 +75,11 @@ jobs:
exit 1
fi
bash scripts/set-version.sh "$ver"
fi
echo "version=$ver" >> "$GITHUB_OUTPUT"
echo "tag=$tag" >> "$GITHUB_OUTPUT"
env:
VERSION: ${{ inputs.version }}
# Gate: never tag code that doesn't build/test. If this fails nothing
# is committed or pushed, so the release simply doesn't happen.