Deploy the Subgraph #18
This file contains 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: Deploy the Subgraph | |
on: | |
workflow_dispatch: | |
inputs: | |
network: | |
description: The network to deploy the subgraph to | |
required: true | |
default: 'arbitrum-sepolia' | |
type: choice | |
options: | |
- arbitrum-sepolia-devnet | |
- arbitrum-sepolia | |
- arbitrum | |
subgraph: | |
description: The name of the subgraph to deploy | |
required: true | |
default: 'core' | |
type: choice | |
options: | |
- core | |
- drt | |
update: | |
description: Whether to update the subgraph with the current artifacts for the selected network. | |
required: true | |
default: true | |
type: boolean | |
permissions: | |
contents: read | |
jobs: | |
buildAndDeploy: | |
runs-on: ubuntu-latest | |
environment: kleros-org-subgraph | |
steps: | |
- name: Harden Runner | |
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.5.0 | |
with: | |
egress-policy: audit | |
- name: Checkout code | |
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3 | |
- name: Set up Node.js | |
uses: actions/setup-node@5e21ff4d9bc1a8cf6de233a3057d20ec6b3fb69d # v3.8.1 | |
with: | |
node-version: 16 | |
- name: Install Yarn if running locally | |
if: ${{ env.ACT }} | |
run: npm install -g yarn | |
- name: Install the dependencies | |
run: yarn install | |
- name: Install jq and yq | |
if: ${{ inputs.update }} | |
run: | | |
mkdir bin | |
wget -qO bin/jq https://github.com/jqlang/jq/releases/download/jq-1.6/jq-linux64 | |
wget -qO bin/yq https://github.com/mikefarah/yq/releases/latest/download/yq_linux_amd64 | |
chmod a+x bin/jq bin/yq | |
- name: Update the subgraph definition | |
if: ${{ inputs.update }} | |
run: | | |
export PATH=$PWD/../bin:$PATH | |
yarn update:${{ inputs.subgraph }}:${{ inputs.network }} | |
working-directory: subgraph | |
- name: Build the subgraph | |
run: | | |
yarn codegen:${{ inputs.subgraph }} | |
yarn build:${{ inputs.subgraph }} | |
working-directory: subgraph | |
- name: Authenticate with TheGraph | |
run: yarn graph auth "${{ secrets.SUBGRAPH_AUTH_TOKEN }}" --product hosted-service | |
working-directory: subgraph | |
- name: Deploy the subgraph | |
run: yarn deploy:${{ inputs.subgraph }}:${{ inputs.network }} | |
working-directory: subgraph |