Skip to content

Commit

Permalink
fix(deploy): update contract deployment scripts for CI integration
Browse files Browse the repository at this point in the history
  • Loading branch information
nelitow committed Nov 13, 2024
1 parent 2912508 commit 5859d0b
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ jobs:
ls -la examples/react-app/src/types/
- name: Build & Deploy Contracts
run: pnpm deploy:contracts
run: pnpm deploy:contracts:ci
working-directory: e2e-tests/runner/scripts

# Check the directory structure after deployment
Expand Down
3 changes: 2 additions & 1 deletion e2e-tests/runner/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"start:react-app": "pnpm --filter react-app dev",
"start:react-next": "pnpm --filter @e2e-tests/react-next dev",
"start:servers": "pnpm run start:react-app & pnpm run start:react-next",
"deploy:contracts": "sh ./scripts/deploy.sh"
"deploy:contracts": "sh ./scripts/deployLocal.sh",
"deploy:contracts:ci": "sh ./scripts/deployCI.sh"
},
"devDependencies": {
"@fuels/connectors": "workspace:*",
Expand Down
File renamed without changes.
20 changes: 20 additions & 0 deletions e2e-tests/runner/scripts/deployLocal.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#!/bin/bash

# Get the directory where the script is located
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"

echo "Build contracts"
pnpm fuels build

echo "Deploy contract"
pnpm fuels deploy

CONTRACT_IDS_PATH="$SCRIPT_DIR/../src/contracts/contract-ids.json"
OUTPUT_PATH_APP="$SCRIPT_DIR/../../../examples/react-app/src/types/contract-ids-local.json"

mkdir -p "$(dirname "$OUTPUT_PATH_APP")"

CONTRACT_ID=$(jq -r '.customAsset // empty' "$CONTRACT_IDS_PATH")

jq -n --arg counter "$CONTRACT_ID" '{ "counter": $counter }' > "$OUTPUT_PATH_APP"
echo "Saved contract ID as 'counter' in contract-ids-local.json"

0 comments on commit 5859d0b

Please sign in to comment.