Skip to content

Commit

Permalink
add capturing world address and using in another job
Browse files Browse the repository at this point in the history
  • Loading branch information
willemolding committed Jan 5, 2024
1 parent 3759405 commit dc5d3c6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 8 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/build-deploy-demo.yaml
Original file line number Diff line number Diff line change
@@ -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
Expand Down Expand Up @@ -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 }}
Expand All @@ -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:
Expand Down
8 changes: 4 additions & 4 deletions justfile
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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

0 comments on commit dc5d3c6

Please sign in to comment.