release-dispatch #165
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
| # Dojo release dispatch workflow. | |
| # | |
| # This workflow is used to manually trigger a release. | |
| # | |
| # The workflow will propose a release with the same version as the one passed as input to the workflow, taking care of updating Cargo.toml versions. | |
| # | |
| # The workflow will create a PR, which must be manually merged to trigger the release. | |
| # If the release triggered by the merged of this PR fails, the `release.yml` workflow can be used to be triggered again on main. | |
| # | |
| name: release-dispatch | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: Version to release | |
| required: true | |
| type: string | |
| jobs: | |
| propose-release: | |
| permissions: | |
| pull-requests: write | |
| contents: write | |
| runs-on: ubuntu-latest | |
| container: | |
| image: ghcr.io/dojoengine/dojo-dev:v1.7.1 | |
| env: | |
| VERSION: "" | |
| steps: | |
| # Workaround described here: https://github.com/actions/checkout/issues/760 | |
| - uses: actions/checkout@v4 | |
| - uses: software-mansion/setup-scarb@v1 | |
| with: | |
| scarb-version: "2.13.1" | |
| - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" | |
| - name: Normalize version and update files | |
| id: version | |
| run: | | |
| INPUT_VERSION="${{ inputs.version }}" | |
| if [[ -z "$INPUT_VERSION" ]]; then | |
| echo "Error: Version input is empty" | |
| exit 1 | |
| fi | |
| CLEAN_VERSION=${INPUT_VERSION#v} | |
| DISPLAY_VERSION="v${CLEAN_VERSION}" | |
| bash scripts/scarb_version_sync.sh --version ${CLEAN_VERSION} | |
| cargo release version ${CLEAN_VERSION} --execute --no-confirm && cargo release replace --execute --no-confirm | |
| echo "display_version=${DISPLAY_VERSION}" >> $GITHUB_OUTPUT | |
| - name: Rebuild Cairo files to update Scarb.lock files | |
| run: | | |
| scarb --manifest-path crates/dojo/core/Scarb.toml build | |
| scarb --manifest-path crates/dojo/dojo-snf-test/Scarb.toml build | |
| scarb --manifest-path crates/dojo/dojo-cairo-test/Scarb.toml build | |
| scarb --manifest-path examples/spawn-and-move/Scarb.toml build | |
| scarb --manifest-path examples/simple/Scarb.toml build | |
| scarb --manifest-path crates/dojo/core-tests/Scarb.toml build | |
| - uses: peter-evans/create-pull-request@v7 | |
| with: | |
| # We have to use a PAT in order to trigger ci | |
| token: ${{ secrets.CREATE_PR_TOKEN }} | |
| title: "release(prepare): ${{ steps.version.outputs.display_version }}" | |
| commit-message: "Prepare release: ${{ steps.version.outputs.display_version }}" | |
| branch: prepare-release | |
| base: main | |
| delete-branch: true |