Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 21 additions & 7 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,12 @@ name: Release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
version:
description: 'Version to release (e.g. 0.1.1)'
required: true
type: string

env:
CARGO_TERM_COLOR: always
Expand Down Expand Up @@ -36,12 +42,18 @@ jobs:
run: |
set -euo pipefail

TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"

if [ -z "$VERSION" ] || [ "$VERSION" = "$TAG" ]; then
echo "Invalid release tag: $TAG"
exit 1
if [ -n "${{ inputs.version }}" ]; then
# workflow_dispatch — use provided version directly
VERSION="${{ inputs.version }}"
else
# tag trigger — strip 'v' prefix
TAG="${{ github.ref_name }}"
VERSION="${TAG#v}"

if [ -z "$VERSION" ] || [ "$VERSION" = "$TAG" ]; then
echo "Invalid release tag: $TAG"
exit 1
fi
fi

echo "Release version: $VERSION"
Expand Down Expand Up @@ -94,8 +106,10 @@ jobs:
return 1
fi

# Strip optional 'v' prefix for crates.io API (num is always bare like "0.1.1")
local bare_version="${version#v}"
echo "$response" |
jq -e --arg version "$version" '.versions[].num == $version' >/dev/null
jq -e --arg version "$bare_version" 'any(.versions[].num; . == $version)' >/dev/null
}

wait_for_crate() {
Expand Down