Skip to content

Commit

Permalink
chore: improved the subgraph deployment workflow to use branch-specif…
Browse files Browse the repository at this point in the history
…ic protected envs
  • Loading branch information
jaybuidl committed Jan 3, 2024
1 parent 0e75b6b commit 76dc61c
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 12 deletions.
26 changes: 15 additions & 11 deletions .github/workflows/deploy-subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ name: Deploy the Subgraph
on:
workflow_dispatch:
inputs:
network:
description: The network to deploy the subgraph to
graph_environment:
description: The Graph environment to deploy to
required: true
default: 'arbitrum-sepolia'
default: 'graph-studio-devnet'
type: choice
options:
- arbitrum-sepolia-devnet
- arbitrum-sepolia
- arbitrum
- graph-studio-devnet
- graph-studio-testnet
- graph-studio-mainnet
subgraph:
description: The name of the subgraph to deploy
required: true
Expand All @@ -32,13 +32,17 @@ permissions:
jobs:
buildAndDeploy:
runs-on: ubuntu-latest
environment: kleros-org-subgraph
environment: ${{ inputs.graph_environment }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.5.0
with:
egress-policy: audit

- name: Validate Network environment variable
if: ${{!startsWith(env.network, 'arbitrum')}}
run: exit 1

- name: Checkout code
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3

Expand Down Expand Up @@ -66,7 +70,7 @@ jobs:
if: ${{ inputs.update }}
run: |
export PATH=$PWD/../bin:$PATH
yarn update:${{ inputs.subgraph }}:${{ inputs.network }}
yarn update:${{ inputs.subgraph }}:${{ env.network }}
working-directory: subgraph

- name: Build the subgraph
Expand All @@ -75,10 +79,10 @@ jobs:
yarn build:${{ inputs.subgraph }}
working-directory: subgraph

- name: Authenticate with TheGraph
run: yarn graph auth "${{ secrets.SUBGRAPH_AUTH_TOKEN }}" --product hosted-service
- name: Authenticate with TheGraph Studio
run: yarn graph auth "${{ secrets.SUBGRAPH_AUTH_TOKEN }}" --studio
working-directory: subgraph

- name: Deploy the subgraph
run: yarn deploy:${{ inputs.subgraph }}:${{ inputs.network }}
run: yarn deploy:${{ inputs.subgraph }}:${{ env.network }}
working-directory: subgraph
2 changes: 1 addition & 1 deletion scripts/act-subgraph.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash

act workflow_dispatch -j buildAndDeploy --input network=arbitrum-sepolia,update=true
act workflow_dispatch -j buildAndDeploy --input graph_environment=graph-studio-devnet,update=true --env network=arbitrum-sepolia-devnet

0 comments on commit 76dc61c

Please sign in to comment.