Skip to content

Commit fe9b14c

Browse files
committed
ci: add workflow_dispatch and rename release content to bevy_octopus
1 parent 6d27789 commit fe9b14c

File tree

1 file changed

+33
-10
lines changed

1 file changed

+33
-10
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,17 @@ name: Release
33
on:
44
push:
55
tags: ["v*"]
6+
workflow_dispatch:
7+
inputs:
8+
version:
9+
description: "Version to release (without 'v' prefix)"
10+
required: true
11+
type: string
12+
publish:
13+
description: "Publish to crates.io"
14+
required: false
15+
default: true
16+
type: boolean
617

718
env:
819
CARGO_TERM_COLOR: always
@@ -61,9 +72,14 @@ jobs:
6172
restore-keys: |
6273
${{ runner.os }}-cargo-release-build-
6374
64-
- name: Extract version from tag
75+
- name: Determine version (tag or manual)
6576
id: version
66-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
77+
run: |
78+
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
79+
echo "VERSION=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT
80+
else
81+
echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
82+
fi
6783
6884
- name: Verify version matches Cargo.toml
6985
run: |
@@ -101,7 +117,7 @@ jobs:
101117
102118
# Generate changelog from commits
103119
if [ -n "$PREV_TAG" ]; then
104-
echo "## 🚀 bevy_mqtt v${{ steps.version.outputs.VERSION }}" > release_notes.md
120+
echo "## 🚀 bevy_octopus v${{ steps.version.outputs.VERSION }}" > release_notes.md
105121
echo "" >> release_notes.md
106122
107123
# Get commits since last tag and categorize them
@@ -172,7 +188,7 @@ jobs:
172188
else
173189
# Fallback for first release
174190
cat > release_notes.md << 'EOF'
175-
## 🚀 bevy_mqtt v${{ steps.version.outputs.VERSION }}
191+
## 🚀 bevy_octopus v${{ steps.version.outputs.VERSION }}
176192
177193
### What's New
178194
This is the initial release or a release without a previous tag for comparison.
@@ -192,26 +208,32 @@ jobs:
192208
### 📦 Installation
193209
\`\`\`toml
194210
[dependencies]
195-
bevy_mqtt = "${{ steps.version.outputs.VERSION }}"
211+
bevy_octopus = "${{ steps.version.outputs.VERSION }}"
196212
\`\`\`
197213
198214
### 🔗 Full Changelog
199-
**Full Changelog**: https://github.com/foxzool/bevy_mqtt/compare/${PREV_TAG}...v${{ steps.version.outputs.VERSION }}
215+
**Full Changelog**: https://github.com/foxzool/bevy_octopus/compare/${PREV_TAG}...v${{ steps.version.outputs.VERSION }}
200216
201217
---
202218
*Built with ❤️ using Bevy ECS*
203219
EOF
204220
221+
- name: Create tag for manual run
222+
if: github.event_name == 'workflow_dispatch'
223+
run: |
224+
git config user.name github-actions
225+
git config user.email [email protected]
226+
git tag -a v${{ steps.version.outputs.VERSION }} -m "chore(release): v${{ steps.version.outputs.VERSION }}" || true
227+
git push origin v${{ steps.version.outputs.VERSION }} || true
228+
205229
- name: Create GitHub Release
206230
uses: softprops/[email protected]
207231
with:
208232
tag_name: v${{ steps.version.outputs.VERSION }}
209-
name: bevy_mqtt v${{ steps.version.outputs.VERSION }}
233+
name: bevy_octopus v${{ steps.version.outputs.VERSION }}
210234
body_path: release_notes.md
211235
draft: false
212236
prerelease: ${{ steps.prerelease_check.outputs.prerelease }}
213-
files: |
214-
target/release/bevy_mqtt-*.tar.gz
215237
env:
216238
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
217239

@@ -222,11 +244,12 @@ jobs:
222244
run: cargo build --release
223245

224246
- name: Publish to crates.io
247+
if: github.event_name == 'push' || (github.event_name == 'workflow_dispatch' && github.event.inputs.publish == 'true')
225248
run: cargo publish --token ${{ secrets.CARGO_REGISTRY_TOKEN }}
226249
env:
227250
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
228251

229252
- name: Wait for crates.io index (with timeout)
230253
run: |
231254
echo "⏳ Waiting for crates.io to index the new version..."
232-
timeout 300 bash -c 'until cargo search bevy_mqtt --limit 1 | grep -q "${{ steps.version.outputs.VERSION }}"; do sleep 10; done' || echo "⚠️ Timeout waiting for crates.io indexing, but release should still be successful"
255+
timeout 300 bash -c 'until cargo search bevy_octopus --limit 1 | grep -q "${{ steps.version.outputs.VERSION }}"; do sleep 10; done' || echo "⚠️ Timeout waiting for crates.io indexing, but release should still be successful"

0 commit comments

Comments
 (0)