|
| 1 | +name: Deploy PoCo Contracts |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + network: |
| 6 | + description: 'Network' |
| 7 | + required: true |
| 8 | + type: choice |
| 9 | + options: |
| 10 | + - hardhat |
| 11 | + - arbitrumSepolia |
| 12 | + - arbitrum |
| 13 | + - avalancheFujiTestnet |
| 14 | + - bellecour |
| 15 | + default: 'hardhat' |
| 16 | + |
| 17 | +jobs: |
| 18 | + # Build and test before deploying. |
| 19 | + build-and-test: |
| 20 | + uses: ./.github/workflows/main.yml |
| 21 | + |
| 22 | + deploy: |
| 23 | + needs: build-and-test |
| 24 | + runs-on: ubuntu-latest |
| 25 | + permissions: |
| 26 | + contents: write # Required for saving deployment |
| 27 | + environment: ${{ inputs.network }} # Use the selected environment |
| 28 | + steps: |
| 29 | + - name: Checkout |
| 30 | + uses: actions/checkout@v4 |
| 31 | + |
| 32 | + - name: Set up Nodejs |
| 33 | + uses: actions/setup-node@v4 |
| 34 | + with: |
| 35 | + node-version: 20 |
| 36 | + cache: 'npm' # Cache dependencies |
| 37 | + |
| 38 | + - name: Install dependencies |
| 39 | + run: npm ci |
| 40 | + |
| 41 | + - name: Build |
| 42 | + run: npm run build |
| 43 | + |
| 44 | + # TODO activate later. |
| 45 | + # - name: Run fork tests |
| 46 | + # run: | |
| 47 | + # if [ "${{ inputs.network }}" == "arbitrumSepolia" ]; then |
| 48 | + # npm run test:arbitrumSepolia |
| 49 | + # elif [ "${{ inputs.network }}" == "avalancheFujiTestnet" ]; then |
| 50 | + # npm run test:fuji |
| 51 | + # fi |
| 52 | + |
| 53 | + - name: Deploy contracts |
| 54 | + env: |
| 55 | + DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} |
| 56 | + RPC_URL: ${{ secrets.RPC_URL }} |
| 57 | + ARBISCAN_API_KEY: ${{ secrets.ARBISCAN_API_KEY }} |
| 58 | + # TODO: Use Etherscan V2 API |
| 59 | + # EXPLORER_API_KEY: ${{ secrets.EXPLORER_API_KEY }} |
| 60 | + # IS_VERIFICATION_API_V2: ${{ vars.IS_VERIFICATION_API_V2 }} |
| 61 | + run: npm run deploy -- --network ${{ inputs.network }} |
| 62 | + |
| 63 | + - name: Update config.json with ERC1538Proxy address |
| 64 | + if: inputs.network != 'hardhat' |
| 65 | + env: |
| 66 | + DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} |
| 67 | + run: npx hardhat run scripts/tools/update-config.ts --network ${{ inputs.network }} |
| 68 | + |
| 69 | + - name: Save deployment artifacts and updated config |
| 70 | + if: inputs.network != 'hardhat' |
| 71 | + uses: stefanzweifel/git-auto-commit-action@v5 |
| 72 | + with: |
| 73 | + commit_message: 'chore: Save deployment artifacts for ${{ inputs.network }} (run_id: ${{ github.run_id }})' |
| 74 | + file_pattern: 'deployments/${{ inputs.network }}/* config/config.json' |
| 75 | + commit_user_name: 'GitHub Actions Bot' |
| 76 | + commit_user_email: 'github-actions[bot]@users.noreply.github.com' |
| 77 | + commit_author: 'GitHub Actions Bot <github-actions[bot]@users.noreply.github.com>' |
0 commit comments