Skip to content

Merge branch 'main' of github.com:ArcaneAssemblers/spellcrafter #58

Merge branch 'main' of github.com:ArcaneAssemblers/spellcrafter

Merge branch 'main' of github.com:ArcaneAssemblers/spellcrafter #58

name: Deploy Demo
on:
# Runs on pushes targeting the default branch
push:
branches: ['main']
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true
jobs:
build-and-deploy-contracts:
runs-on: ubuntu-latest
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 }}
DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }}
steps:
- uses: actions/checkout@v3
- run: curl -L https://install.dojoengine.org | bash
- run: /home/runner/.config/.dojo/bin/dojoup --version v0.3.15
- id: deploy
run: |
/home/runner/.config/.dojo/bin/sozo build
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"
echo "Contracts deployed to world at $WORLD_ADDRESS" >> $GITHUB_STEP_SUMMARY
build-and-deploy-client:
runs-on: ubuntu-latest
needs: build-and-deploy-contracts
defaults:
run:
working-directory: ./client
env:
VITE_PUBLIC_WORLD_ADDRESS: ${{ needs.build-and-deploy-contracts.outputs.WORLD_ADDRESS }}
VITE_PUBLIC_NODE_URL: ${{ vars.STARKNET_RPC_URL }}
VITE_PUBLIC_TORII: ${{ vars.TORII_URL }}
VITE_PUBLIC_MASTER_ADDRESS: ${{ vars.DEPLOYER_ADDRESS }}
VITE_PUBLIC_MASTER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }}
steps:
- uses: actions/checkout@v4
- name: Use bun
uses: oven-sh/setup-bun@v1
- run: bun install
- run: bun run build
- name: Setup Pages
uses: actions/configure-pages@v3
- name: Upload artifact
uses: actions/upload-pages-artifact@v1
with:
path: './client/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1