release-dispatch #32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: release-dispatch | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: Version type to release | |
| required: false | |
| type: choice | |
| default: custom | |
| options: | |
| - major | |
| - minor | |
| - patch | |
| - release | |
| - rc | |
| - beta | |
| - alpha | |
| - custom | |
| custom_version: | |
| description: Custom version (used when `version_type` is 'custom') | |
| required: false | |
| type: string | |
| jobs: | |
| propose-release: | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/dojoengine/katana-dev:latest | |
| env: | |
| VERSION: "" | |
| steps: | |
| - name: "Validate inputs" | |
| run: | | |
| if [ "${{ inputs.version_type }}" = "custom" ] && [ -z "${{ inputs.custom_version }}" ]; then | |
| echo "error: custom_version is required when version_type is 'custom'" | |
| exit 1 | |
| fi | |
| if [ "${{ inputs.version_type }}" != "custom" ] && [ -n "${{ inputs.custom_version }}" ]; then | |
| echo "error: custom_version should be empty when version_type is not 'custom'" | |
| exit 1 | |
| fi | |
| - uses: actions/checkout@v4 | |
| - run: git config --global --add safe.directory "*" | |
| - name: "Setup toolchain" | |
| uses: "actions-rs/toolchain@v1" | |
| with: | |
| toolchain: "stable" | |
| - run: | | |
| if [ "${{ inputs.version_type }}" = "custom" ]; then | |
| VERSION=${{ inputs.custom_version }} | |
| else | |
| VERSION=${{ inputs.version_type }} | |
| fi | |
| VERSION=${VERSION#v} | |
| cargo release version $VERSION --execute --no-confirm && cargo release replace --execute --no-confirm | |
| - id: version_info | |
| run: | | |
| echo "version=$(cargo get workspace.package.version)" >> $GITHUB_OUTPUT | |
| - uses: peter-evans/create-pull-request@v7 | |
| with: | |
| token: ${{ secrets.CREATE_PR_TOKEN }} | |
| title: "release(prepare): v${{ steps.version_info.outputs.version }}" | |
| commit-message: "release(prepare): v${{ steps.version_info.outputs.version }}" | |
| branch: prepare-release | |
| base: main | |
| delete-branch: true |