feat: add general cross messages docs (#1252) #123
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Auto-deploy IPC contracts to Calibrationnet when changed | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
paths: | |
- contracts/** | |
permissions: | |
contents: write | |
env: | |
GIT_USERNAME: github-actions[bot] | |
GIT_EMAIL: ipc+github-actions[bot]@users.noreply.github.com | |
concurrency: | |
# Only allow one run at a time for this workflow | |
group: auto-deploy-contracts | |
cancel-in-progress: true | |
jobs: | |
deploy-contracts: | |
runs-on: ubuntu-latest | |
env: | |
RPC_URL: https://calibration.filfox.io/rpc/v1 | |
PRIVATE_KEY: ${{ secrets.CONTRACTS_DEPLOYER_PRIVATE_KEY }} | |
steps: | |
- name: Configure git | |
run: | | |
git config --global user.name "$GIT_USERNAME" | |
git config --global user.email "$GIT_EMAIL" | |
- name: Check out the branch that triggered this run | |
uses: actions/checkout@v4 | |
with: | |
ref: ${{ github.ref_name }} | |
submodules: recursive | |
fetch-depth: 0 | |
- uses: pnpm/action-setup@v2 | |
- name: Set up node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
cache: 'pnpm' | |
- name: Install Foundry | |
uses: foundry-rs/foundry-toolchain@v1 | |
- name: Restore cache | |
id: cache-restore | |
uses: actions/cache/restore@v4 | |
with: | |
## Hardhat is intelligent enough to perform incremental compilation. But GitHub Actions caches are immutable. | |
## Since we can't have a rolling cache, we create a new cache for each run, but use restore-keys to load the | |
## most recently created cache. | |
## Reference: https://github.com/actions/cache/blob/main/tips-and-workarounds.md#update-a-cache | |
key: ${{ runner.os }}-contracts-artifacts-${{ github.run_id }} | |
restore-keys: | | |
${{ runner.os }}-contracts-artifacts- | |
path: | | |
contracts/out | |
contracts/deployments | |
contracts/artifacts | |
- name: Deploy IPC contracts to Calibrationnet | |
id: deploy_contracts | |
env: | |
REGISTRY_CREATION_PRIVILEGES: 'unrestricted' | |
run: | | |
cd contracts | |
pnpm install | |
make deploy-stack NETWORK=calibrationnet | |
- name: Save cache | |
id: cache-save | |
uses: actions/cache/save@v4 | |
if: always() && steps.cache-restore.outputs.cache-hit != 'true' | |
with: | |
key: ${{ runner.os }}-contracts-artifacts-${{ github.run_id }} | |
path: | | |
contracts/out | |
contracts/deployments | |
contracts/artifacts | |
- name: Populate output | |
run: | | |
cd contracts | |
jq -n --arg commit "$(git rev-parse HEAD)" \ | |
--arg gateway_addr "$(jq -r '.address' deployments/calibrationnet/GatewayDiamond.json)" \ | |
--arg registry_addr "$(jq -r '.address' deployments/calibrationnet/SubnetRegistryDiamond.json)" \ | |
'{"commit":$commit, "gateway_addr":$gateway_addr, "registry_addr":$registry_addr}' > /tmp/output.json | |
cat /tmp/output.json | |
- name: Switch code repo to cd/contracts branch | |
uses: actions/checkout@v4 | |
with: | |
ref: cd/contracts | |
submodules: recursive | |
fetch-depth: 0 | |
- name: Commit and push deployment info | |
run: | | |
mkdir -p deployments | |
cp /tmp/output.json deployments/r314159.json | |
git add deployments/r314159.json | |
git commit -m "Contracts deployed @ ${{ github.sha }}" | |
git push origin cd/contracts |