The Graph - Manual Deployment to Dev #9
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
| name: The Graph - Manual Deployment to Dev | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| network: | |
| description: "Network for Subgraph deployment - (Gnosis Chain or Ethereum)" | |
| required: true | |
| options: | |
| - Ethereum | |
| - Gnosis Chain | |
| type: choice | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Deployment | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: subgraph/ | |
| outputs: | |
| random_id: ${{ steps.random_id.outputs.random_id }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: '**/node_modules' | |
| key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Check for excluded branches | |
| if: startsWith(github.ref, 'refs/heads/main') | |
| run: | | |
| echo "This branch is excluded from workflow dispatch." | |
| exit 1 | |
| - name: Generate Random ID | |
| id: random_id | |
| run: | | |
| echo "random_id=$(openssl rand -hex 4)" >> $GITHUB_OUTPUT | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install graph-cli & dependencies | |
| run: | | |
| yarn install | |
| - name: Build Subgraph | |
| run: yarn codegen && yarn build | |
| - name: Authenticate to Subgraph Studio | |
| run: graph auth --studio ${{ secrets.THEGRAPH_DEPLOY_API_KEY }} | |
| - name: Deploy Subgraph for ETH Mainnet | |
| if: ${{ inputs.network == 'Ethereum' }} | |
| env: | |
| SUBGRAPH_NAME: gbc-bridge-mainnet | |
| ACCESS_TOKEN: ${{ secrets.THEGRAPH_DEPLOY_API_KEY }} | |
| run: yarn deploy -l "${{ github.ref_name }}-${{ steps.random_id.outputs.random_id }}" | |
| - name: Deploy Subgraph for Gnosis Chain | |
| if: ${{ inputs.network == 'Gnosis Chain' }} | |
| env: | |
| SUBGRAPH_NAME: gbc-bridge-gnosis | |
| ACCESS_TOKEN: ${{ secrets.THEGRAPH_DEPLOY_API_KEY }} | |
| run: yarn deploy -l "${{ github.ref_name }}-${{ steps.random_id.outputs.random_id }}" | |
| notify: | |
| uses: ./.github/workflows/slack_release_notification.yml | |
| if: ${{ always() }} | |
| needs: deploy | |
| secrets: | |
| RELEASES_SLACK_WEBHOOK_URL: ${{ secrets.RELEASES_SLACK_WEBHOOK_URL }} | |
| with: | |
| environment: Development | |
| service: Bridge Monitor SubGraph | |
| success: ${{ contains(join(needs.*.result, ','), 'success') }} | |
| message: "deploy service `Bridge Monitor SubGraph` version `${{ github.ref_name }}-${{ needs.deploy.outputs.random_id }}`. Triggered by `${{ github.actor }}`." | |