From dc5d3c64e5c609a3a884e55aff49d7ec5f768fea Mon Sep 17 00:00:00 2001 From: Willem Olding Date: Fri, 5 Jan 2024 21:13:54 +1100 Subject: [PATCH] add capturing world address and using in another job --- .github/workflows/build-deploy-demo.yaml | 16 ++++++++++++---- justfile | 8 ++++---- 2 files changed, 16 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build-deploy-demo.yaml b/.github/workflows/build-deploy-demo.yaml index 0df1978..3b3ee8d 100644 --- a/.github/workflows/build-deploy-demo.yaml +++ b/.github/workflows/build-deploy-demo.yaml @@ -1,5 +1,4 @@ -# Simple workflow for deploying static content to GitHub Pages -name: Deploy Demo GitHub Pages +name: Deploy Demo on: # Runs on pushes targeting the default branch @@ -27,6 +26,8 @@ jobs: defaults: run: working-directory: ./contracts + outputs: + WORLD_ADDRESS: ${{ steps.deploy.outputs.WORLD_ADDRESS }} env: STARKNET_RPC_URL: ${{ vars.STARKNET_RPC_URL }} DEPLOYER_ADDRESS: ${{ vars.DEPLOYER_ADDRESS }} @@ -35,10 +36,17 @@ jobs: - uses: actions/checkout@v3 - run: curl -L https://install.dojoengine.org | bash - run: /home/runner/.config/.dojo/bin/dojoup --version v0.3.15 - - run: | + - id: deploy + run: | /home/runner/.config/.dojo/bin/sozo build - /home/runner/.config/.dojo/bin/sozo migrate --name="arcane" --rpc-url="$STARKNET_RPC_URL" --account-address="$DEPLOYER_ADDRESS" --private-key="$DEPLOYER_PRIVATE_KEY" + WORLD_ADDRESS=$(/home/runner/.config/.dojo/bin/sozo migrate --name="arcane" --rpc-url="$STARKNET_RPC_URL" --account-address="$DEPLOYER_ADDRESS" --private-key="$DEPLOYER_PRIVATE_KEY" | grep "at address" | grep -oE9 '(0x[a-fA-F0-9]{63})') + echo "WORLD_ADDRESS=$WORLD_ADDRESS" >> "$GITHUB_OUTPUT" + print-world-address: + runs-on: ubuntu-latest + needs: build-and-deploy-contracts + steps: + - run: echo ${{ needs.build-and-deploy-contracts.outputs.WORLD_ADDRESS }} # build-and-deploy: # runs-on: ubuntu-latest # defaults: diff --git a/justfile b/justfile index 1440a36..b98996a 100644 --- a/justfile +++ b/justfile @@ -2,7 +2,7 @@ set positional-arguments set export DOJO_VERSION := "0.3.15" -RPC_URL := "http://localhost:5050" +STARKNET_RPC_URL := "http://localhost:5050" default: just --list @@ -42,7 +42,7 @@ set_auth: cd contracts for component in ${COMPONENTS[@]}; do - sozo auth writer $component $GAME_ADDRESS --world $WORLD_ADDRESS --rpc-url $RPC_URL + sozo auth writer $component $GAME_ADDRESS --world $WORLD_ADDRESS --rpc-url $STARKNET_RPC_URL done # start the dev server hosting the web client @@ -53,9 +53,9 @@ start_client: start_devnet: katana --disable-fee --seed=0 -# Requires a devnet running on localhost:5050 +# Requires a devnet running on STARKNET_RPC_URL start_indexer: #!/usr/bin/env bash set -euxo pipefail WORLD_ADDRESS=$(cat ./contracts/target/dev/manifest.json | jq -r '.world.address') - torii --world ${WORLD_ADDRESS} --rpc $RPC_URL + torii --world ${WORLD_ADDRESS} --rpc $STARKNET_RPC_URL