The Graph - Manual Deployment to Prod #12
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 Prod | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version to deploy" | |
| required: true | |
| type: string | |
| 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 | |
| env: | |
| DEPLOY_API_KEY: ${{ secrets.THEGRAPH_DEPLOY_API_KEY }} | |
| DEBUG: true | |
| if: github.ref == 'refs/heads/main' | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/cache@v4 | |
| with: | |
| path: '**/node_modules' | |
| key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} | |
| - name: Check version tag exists | |
| id: release_tag | |
| run: | | |
| TAG_EXISTS=$(git tag -l "${{ inputs.version }}") | |
| if [ -z "$TAG_EXISTS" ]; then | |
| echo "Version ${{ inputs.version }} does not exist." | |
| exit 1 | |
| else | |
| echo "tag=$TAG_EXISTS" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Install dependencies | |
| run: | | |
| cd subgraph | |
| yarn install | |
| - name: Generate Random ID for buildcode | |
| id: random_id | |
| run: | | |
| echo "random_id=$(openssl rand -hex 4)" >> $GITHUB_OUTPUT | |
| - name: Build & Deploy Subgraph for ETH mainnet | |
| if: ${{ inputs.network == 'Ethereum' }} | |
| env: | |
| SUBGRAPH_LABELS: "${{ steps.release_tag.outputs.tag }}-${{ steps.random_id.outputs.random_id }}" | |
| TYPE: foreign | |
| DEBUG: true | |
| SUBGRAPH_NAME: gbc-bridge-mainnet | |
| NETWORK: mainnet | |
| run: | | |
| cd subgraph | |
| yarn build | |
| yarn deploy | |
| - name: Build & Deploy Subgraph for Gnosis Chain | |
| if: ${{ inputs.network == 'Gnosis Chain' }} | |
| env: | |
| SUBGRAPH_LABELS: "${{ steps.release_tag.outputs.tag }}-${{ steps.random_id.outputs.random_id }}" | |
| TYPE: home | |
| DEBUG: true | |
| SUBGRAPH_NAME: gbc-bridge-gnosis | |
| NETWORK: gnosis | |
| run: | | |
| cd subgraph | |
| yarn build | |
| yarn deploy | |
| notify: | |
| uses: ./.github/workflows/slack_release_notification.yml | |
| if: ${{ always() }} | |
| needs: deploy | |
| secrets: | |
| RELEASES_SLACK_WEBHOOK_URL: ${{ secrets.RELEASES_SLACK_WEBHOOK_URL }} | |
| with: | |
| environment: Production | |
| service: Bridge Monitor SubGraph | |
| success: ${{ contains(join(needs.*.result, ','), 'success') }} | |
| message: "deploy service `Bridge Monitor SubGraph` version `${{ inputs.version }}`. Triggered by `${{ github.actor }}`." | |