-
Notifications
You must be signed in to change notification settings - Fork 203
72 lines (64 loc) · 2.61 KB
/
Copy pathrelease-dispatch.yml
File metadata and controls
72 lines (64 loc) · 2.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 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