Skip to content

Commit b7d0ab6

Browse files
committed
fix(ci): add release dispatch back
1 parent e384dfa commit b7d0ab6

File tree

1 file changed

+100
-0
lines changed

1 file changed

+100
-0
lines changed
Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release Dispatch
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_type:
7+
description: 'What to release'
8+
required: true
9+
type: choice
10+
options:
11+
- workspace
12+
- torii-tokens
13+
- torii-erc20
14+
version:
15+
description: 'Release version (e.g., "0.2.0" or "v0.2.0")'
16+
required: true
17+
type: string
18+
19+
jobs:
20+
propose-release:
21+
name: Propose Release
22+
runs-on: ubuntu-latest
23+
steps:
24+
- uses: actions/checkout@v4
25+
with:
26+
token: ${{ secrets.CREATE_PR_TOKEN }}
27+
28+
- name: Setup Rust toolchain
29+
uses: actions-rust-lang/setup-rust-toolchain@v1
30+
31+
- name: Install cargo-release and cargo-get
32+
run: |
33+
cargo install cargo-release
34+
cargo install cargo-get
35+
36+
- name: Strip version prefix
37+
id: version
38+
run: |
39+
VERSION="${{ inputs.version }}"
40+
VERSION="${VERSION#v}"
41+
echo "VERSION=$VERSION" >> $GITHUB_OUTPUT
42+
echo "Preparing release for version: $VERSION"
43+
44+
- name: Bump workspace version
45+
if: inputs.release_type == 'workspace'
46+
run: |
47+
cargo release version ${{ steps.version.outputs.VERSION }} --execute --no-confirm
48+
cargo release replace --execute --no-confirm
49+
50+
- name: Bump binary version
51+
if: inputs.release_type != 'workspace'
52+
run: |
53+
cargo release version ${{ steps.version.outputs.VERSION }} --execute --no-confirm -p ${{ inputs.release_type }}
54+
cargo release replace --execute --no-confirm -p ${{ inputs.release_type }}
55+
56+
- name: Extract release info
57+
id: release-info
58+
run: |
59+
if [ "${{ inputs.release_type }}" = "workspace" ]; then
60+
NEW_VERSION=$(cargo get workspace.package.version)
61+
RELEASE_NAME="workspace"
62+
BRANCH_NAME="prepare-release-workspace"
63+
else
64+
NEW_VERSION=$(cargo get package.version --entry bins/${{ inputs.release_type }})
65+
RELEASE_NAME="${{ inputs.release_type }}"
66+
BRANCH_NAME="prepare-release-${{ inputs.release_type }}"
67+
fi
68+
echo "NEW_VERSION=$NEW_VERSION" >> $GITHUB_OUTPUT
69+
echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_OUTPUT
70+
echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_OUTPUT
71+
echo "Version bumped to: $NEW_VERSION for $RELEASE_NAME"
72+
73+
- name: Create Pull Request
74+
uses: peter-evans/create-pull-request@v7
75+
with:
76+
token: ${{ secrets.CREATE_PR_TOKEN }}
77+
commit-message: "release(prepare): ${{ steps.release-info.outputs.RELEASE_NAME }} v${{ steps.release-info.outputs.NEW_VERSION }}"
78+
title: "release(prepare): ${{ steps.release-info.outputs.RELEASE_NAME }} v${{ steps.release-info.outputs.NEW_VERSION }}"
79+
body: |
80+
## Release Preparation
81+
82+
This PR prepares **${{ steps.release-info.outputs.RELEASE_NAME }}** for version **v${{ steps.release-info.outputs.NEW_VERSION }}**.
83+
84+
### Changes
85+
${{ inputs.release_type == 'workspace' && format('- Updated workspace version to `{0}`
86+
- Updated all workspace member versions (libraries and crates)
87+
- Updated internal workspace dependencies', steps.release-info.outputs.NEW_VERSION) || format('- Updated `{0}` binary version to `{1}`
88+
- Updated dependencies if needed', inputs.release_type, steps.release-info.outputs.NEW_VERSION) }}
89+
90+
### Next Steps
91+
Once this PR is merged, the release workflow will automatically:
92+
${{ inputs.release_type == 'workspace' && '1. Tag the release as `workspace-v' + steps.release-info.outputs.NEW_VERSION + '`
93+
2. No binaries or Docker images will be built (workspace release only)' || format('1. Build `{0}` binaries for 6 platforms (Linux, macOS, Windows on x64/ARM)
94+
2. Create a draft GitHub release with all artifacts
95+
3. Build and push multi-platform Docker image to GHCR: `{0}:{1}`', inputs.release_type, steps.release-info.outputs.NEW_VERSION) }}
96+
97+
**Review the changes and merge when ready to proceed with the release.**
98+
branch: ${{ steps.release-info.outputs.BRANCH_NAME }}
99+
delete-branch: true
100+
base: main

0 commit comments

Comments
 (0)