Skip to content

Manual Deployment to Prod #3

Manual Deployment to Prod

Manual Deployment to Prod #3

Workflow file for this run

name: 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
- ALL
type: choice
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Deployment
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/main'
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/cache@v2
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Check version tag exists
run: |
TAG_EXISTS=$(git tag -l "${{ inputs.version }}")
if [ -z "$TAG_EXISTS" ]; then
echo "Version ${{ inputs.version }} does not exist."
exit 1
fi
- name: Get version Release Tag
id: release_tag
run: echo "tag=$(git describe --abbrev=0 --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_OUTPUT
- name: Setup Node.js
uses: actions/setup-node@v2
with:
node-version-file: '.nvmrc'
- name: Install graph-cli & dependencies
run: |
yarn run clean
yarn global add @graphprotocol/graph-cli
yarn install
- name: Build Subgraph for ETH mainnet
if: ${{ inputs.network == 'Ethereum' }}
run: yarn codegen && yarn build
- name: Build Subgraph for Gnosis Chain
if: ${{ inputs.network == 'Gnosis Chain' }}
run: yarn codegen && yarn build:gc
- name: Build Subgraph for both Netwroks
if: ${{ inputs.network == 'ALL' }}
run: yarn doall
- name: Authenticate to Subgraph Studio
run: graph auth --studio ${{ secrets.DEPLOY_KEY }}
# Script to deploy to development environment
- name: Deploy Subgraph for ETH mainnet
if: ${{ inputs.network == 'Ethereum' }}
run: yarn deploy -l "${{ steps.release_tag.outputs.tag }}"
- name: Deploy Subgraph for Gnosis Chain
if: ${{ inputs.network == 'Gnosis Chain' }}
run: yarn deploy:gc -l "${{ steps.release_tag.outputs.tag }}"
- name: Deploy Subgraph for both Netwroks
if: ${{ inputs.network == 'ALL' }}
run: yarn deploy -l "${{ steps.release_tag.outputs.tag }}" && yarn deploy:gc -l "${{ steps.release_tag.outputs.tag }}"
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: GC Voting Snapshot SubGraph
success: ${{ contains(join(needs.*.result, ','), 'success') }}
message: "deploy service `GC Voting Snapshot SubGraph` version `${{ inputs.version }}`. Triggered by `${{ github.actor }}`."