Skip to content

release-dispatch-sozo #17

release-dispatch-sozo

release-dispatch-sozo #17

# Sozo release dispatch workflow.
#
# This workflow prepares a PR that bumps the Sozo version (via the shared workspace version)
# without touching Cairo/Scarb packages. Merging that PR will trigger the Sozo release workflow.
name: release-dispatch-sozo
on:
workflow_dispatch:
inputs:
version:
description: Version to release (with or without leading v)
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
- run: git config --global --add safe.directory "$GITHUB_WORKSPACE"
- name: Install cargo-release
run: cargo install cargo-release --version 0.25.20 --locked
- name: Normalize version and update files
id: version
working-directory: ./bin/sozo
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}"
# Manually update the version in the Cargo.toml files, until we have a proper
# rework of the Dojo crates and Sozo isolation.
set -e
SOZO_MANIFESTS="./Cargo.toml ../../crates/sozo/mcp/Cargo.toml ../../crates/sozo/ops/Cargo.toml ../../crates/sozo/signers/Cargo.toml ../../crates/sozo/ui/Cargo.toml ../../crates/sozo/walnut/Cargo.toml"
for manifest in $SOZO_MANIFESTS; do
tmp="$(mktemp)"
if ! awk -v ver="$CLEAN_VERSION" '
BEGIN { updated = 0 }
!updated && /^[[:space:]]*version[[:space:]]*=/ {
sub(/=.*/, "= \"" ver "\"")
updated = 1
}
{ print }
END {
if (!updated) exit 1
}
' "$manifest" > "$tmp"; then
echo "Failed to update version in $manifest"
exit 1
fi
mv "$tmp" "$manifest"
done
cargo release version ${CLEAN_VERSION} --execute --no-confirm
cargo release replace --execute --no-confirm
echo "display_version=${DISPLAY_VERSION}" >> $GITHUB_OUTPUT
- uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.CREATE_PR_TOKEN }}
title: "release-sozo(prepare): ${{ steps.version.outputs.display_version }}"
commit-message: "Prepare Sozo release: ${{ steps.version.outputs.display_version }}"
branch: prepare-release-sozo
base: main
delete-branch: true