Upgrade PoCo Facets #16
This file contains hidden or 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
| # This is a generic workflow that should be used to upgrade PoCo facets. | |
| # Change the environment variable `UPGRADE_SCRIPT` to point to the correct | |
| # script for each specific upgrade. | |
| name: Upgrade PoCo Facets | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| network: | |
| description: 'Network' | |
| required: true | |
| type: choice | |
| options: | |
| - arbitrumSepolia | |
| - arbitrum | |
| default: 'arbitrumSepolia' | |
| dry-run: | |
| description: 'Dry Run (fork test only, no actual deployment)' | |
| required: true | |
| type: boolean | |
| default: true | |
| jobs: | |
| pre-upgrade: | |
| uses: ./.github/workflows/main.yml | |
| upgrade: | |
| needs: pre-upgrade | |
| runs-on: ubuntu-latest | |
| environment: ${{ inputs.network }} | |
| permissions: | |
| contents: write # Required to commit artifacts. | |
| pull-requests: write # Required to create pull requests. | |
| env: | |
| UPGRADE_SCRIPT: 'v6.1.0-bulk-processing.ts' # Update this for each specific upgrade. | |
| COMMIT_MESSAGE: 'chore: Save upgrade artifacts - ${{ inputs.network }} (runId:${{ github.run_id }})' | |
| GHA_BOT_NAME: 'GitHub Actions Bot' | |
| GHA_BOT_EMAIL: 'github-actions[bot]@users.noreply.github.com' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Set up Nodejs | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 20 | |
| cache: 'npm' # Cache dependencies | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Run fork test (dry run) | |
| if: inputs.dry-run == true | |
| env: | |
| # Note: it is required to define both private key env variables when calling Hardhat. | |
| DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} | |
| ADMIN_PRIVATE_KEY: ${{ secrets.ADMIN_PRIVATE_KEY }} | |
| run: | | |
| echo "Running upgrade in fork test mode (dry run)..." | |
| if [ "${{ inputs.network }}" == "arbitrumSepolia" ]; then | |
| export ARBITRUM_SEPOLIA_FORK=true | |
| elif [ "${{ inputs.network }}" == "arbitrum" ]; then | |
| export ARBITRUM_FORK=true | |
| fi | |
| UPGRADE_SCRIPT=${{ env.UPGRADE_SCRIPT }} bash ./scripts/upgrades/dry-run.sh | |
| - name: Execute upgrade on live network | |
| if: inputs.dry-run == false | |
| env: | |
| # Note: it is required to define both private key env variables when calling Hardhat. | |
| DEPLOYER_PRIVATE_KEY: ${{ secrets.DEPLOYER_PRIVATE_KEY }} | |
| ADMIN_PRIVATE_KEY: ${{ secrets.ADMIN_PRIVATE_KEY }} | |
| RPC_URL: ${{ secrets.RPC_URL }} | |
| EXPLORER_API_KEY: ${{ secrets.EXPLORER_API_KEY }} | |
| run: | | |
| npx hardhat run scripts/upgrades/${{ env.UPGRADE_SCRIPT }} --network ${{ inputs.network }} | |
| - name: Push artifacts to the current branch | |
| if: inputs.dry-run == false && github.ref != 'refs/heads/main' | |
| uses: stefanzweifel/git-auto-commit-action@v5 | |
| with: | |
| file_pattern: | | |
| deployments/${{ inputs.network }}/ | |
| commit_message: ${{ env.COMMIT_MESSAGE }} | |
| commit_user_name: ${{ env.GHA_BOT_NAME }} | |
| commit_user_email: ${{ env.GHA_BOT_EMAIL }} | |
| commit_author: '${{ env.GHA_BOT_NAME }} <${{ env.GHA_BOT_EMAIL }}>' | |
| # Since the `main` branch is protected, create a PR to push artifacts. | |
| - name: Push artifacts through a pull request | |
| if: inputs.dry-run == false && github.ref == 'refs/heads/main' | |
| uses: peter-evans/create-pull-request@v7 | |
| with: | |
| add-paths: | | |
| deployments/${{ inputs.network }}/ | |
| commit-message: ${{ env.COMMIT_MESSAGE }} | |
| committer: '${{ env.GHA_BOT_NAME }} <${{ env.GHA_BOT_EMAIL }}>' | |
| author: '${{ env.GHA_BOT_NAME }} <${{ env.GHA_BOT_EMAIL }}>' | |
| branch: chore/save-upgrade-artifacts-${{ inputs.network }}-${{ github.run_id }} | |
| title: ${{ env.COMMIT_MESSAGE }} | |
| body: | | |
| 🤖 This is an automated pull request created by `${{ github.workflow }}` GitHub Actions | |
| workflow to save upgrade artifacts. | |
| * Network: `${{ inputs.network }}` | |
| * Run: [${{ github.run_id }}](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) | |
| **Note**: Verify deployment before merging this PR. | |
| draft: true |