Skip to content

Commit 06743a7

Browse files
fix: add 'current' option to release workflow for releasing existing version (#231)
Adds ability to release the current version without bumping, useful when version has already been manually bumped but needs to be published.
1 parent 8f7ee83 commit 06743a7

File tree

1 file changed

+51
-33
lines changed

1 file changed

+51
-33
lines changed

.github/workflows/manual-release.yml

Lines changed: 51 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ on:
44
workflow_dispatch:
55
inputs:
66
version:
7-
description: "Version bump type"
7+
description: "Version bump type or explicit version"
88
required: true
99
type: choice
1010
options:
1111
- patch
1212
- minor
1313
- major
14+
- current
1415
default: patch
1516
dry_run:
1617
description: "Dry run (do not publish)"
@@ -142,40 +143,57 @@ jobs:
142143
git status
143144
echo ""
144145
145-
# Debug: Show what cargo-release will do
146-
echo "Checking what cargo-release will do..."
147-
cargo release ${{ inputs.version }} --list 2>&1 | tee /tmp/release-list.log || true
148-
149-
if ! grep -q "redis-cloud\|redis-enterprise\|redisctl" /tmp/release-list.log; then
150-
echo "::warning::No packages detected by cargo-release. Debug info:"
151-
echo "Workspace members:"
152-
cargo metadata --no-deps --format-version 1 | jq -r '.workspace_members[]'
153-
echo ""
154-
echo "Package metadata:"
155-
for pkg in redis-cloud redis-enterprise redisctl; do
156-
echo "Package: $pkg"
157-
cargo metadata --no-deps --format-version 1 | jq ".packages[] | select(.name == \"$pkg\") | {name, version, publish}"
158-
done
159-
fi
146+
# Handle "current" version option - release without bumping
147+
if [ "${{ inputs.version }}" = "current" ]; then
148+
echo "Releasing current version without bumping..."
160149
161-
# Run cargo-release - it will handle everything
162-
# Use workspace-level release with shared-version
163-
echo "Executing release..."
164-
cargo release ${{ inputs.version }} \
165-
--execute --no-confirm --verbose 2>&1 | tee /tmp/release.log || {
166-
echo "::error::cargo-release failed. Check the logs above for details."
167-
echo ""
168-
echo "Failure analysis:"
169-
if grep -q "no packages selected" /tmp/release.log; then
170-
echo "- cargo-release couldn't find packages to release"
171-
echo "- This usually means a configuration or authentication issue"
172-
fi
173-
if grep -q "failed to connect" /tmp/release.log; then
174-
echo "- Network/authentication issue detected"
175-
echo "- Verify CARGO_REGISTRY_TOKEN is valid"
150+
# Get current version
151+
CURRENT_VERSION=$(cargo metadata --no-deps --format-version 1 | jq -r '.workspace.metadata.package.version // .packages[0].version')
152+
echo "Current version: $CURRENT_VERSION"
153+
154+
# Run cargo-release with the explicit version to skip bumping
155+
echo "Executing release of v$CURRENT_VERSION..."
156+
cargo release $CURRENT_VERSION \
157+
--execute --no-confirm --verbose 2>&1 | tee /tmp/release.log || {
158+
echo "::error::cargo-release failed. Check the logs above for details."
159+
exit 1
160+
}
161+
else
162+
# Debug: Show what cargo-release will do
163+
echo "Checking what cargo-release will do..."
164+
cargo release ${{ inputs.version }} --list 2>&1 | tee /tmp/release-list.log || true
165+
166+
if ! grep -q "redis-cloud\|redis-enterprise\|redisctl" /tmp/release-list.log; then
167+
echo "::warning::No packages detected by cargo-release. Debug info:"
168+
echo "Workspace members:"
169+
cargo metadata --no-deps --format-version 1 | jq -r '.workspace_members[]'
170+
echo ""
171+
echo "Package metadata:"
172+
for pkg in redis-cloud redis-enterprise redisctl; do
173+
echo "Package: $pkg"
174+
cargo metadata --no-deps --format-version 1 | jq ".packages[] | select(.name == \"$pkg\") | {name, version, publish}"
175+
done
176176
fi
177-
exit 1
178-
}
177+
178+
# Run cargo-release - it will handle everything
179+
# Use workspace-level release with shared-version
180+
echo "Executing release..."
181+
cargo release ${{ inputs.version }} \
182+
--execute --no-confirm --verbose 2>&1 | tee /tmp/release.log || {
183+
echo "::error::cargo-release failed. Check the logs above for details."
184+
echo ""
185+
echo "Failure analysis:"
186+
if grep -q "no packages selected" /tmp/release.log; then
187+
echo "- cargo-release couldn't find packages to release"
188+
echo "- This usually means a configuration or authentication issue"
189+
fi
190+
if grep -q "failed to connect" /tmp/release.log; then
191+
echo "- Network/authentication issue detected"
192+
echo "- Verify CARGO_REGISTRY_TOKEN is valid"
193+
fi
194+
exit 1
195+
}
196+
fi
179197
180198
- name: Report Status
181199
if: always()

0 commit comments

Comments
 (0)