Skip to content

Commit a2a7b5d

Browse files
committed
chore: improved the subgraph deployment workflow to use branch-specific protected envs
1 parent 5cbffee commit a2a7b5d

File tree

3 files changed

+21
-17
lines changed

3 files changed

+21
-17
lines changed

.github/workflows/deploy-subgraph.yml

+15-11
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@ name: Deploy the Subgraph
33
on:
44
workflow_dispatch:
55
inputs:
6-
network:
7-
description: The network to deploy the subgraph to
6+
graph_environment:
7+
description: The Graph environment to deploy to
88
required: true
9-
default: 'arbitrum-sepolia'
9+
default: 'graph-studio-devnet'
1010
type: choice
1111
options:
12-
- arbitrum-sepolia-devnet
13-
- arbitrum-sepolia
14-
- arbitrum
12+
- graph-studio-devnet
13+
- graph-studio-testnet
14+
- graph-studio-mainnet
1515
subgraph:
1616
description: The name of the subgraph to deploy
1717
required: true
@@ -32,13 +32,17 @@ permissions:
3232
jobs:
3333
buildAndDeploy:
3434
runs-on: ubuntu-latest
35-
environment: kleros-org-subgraph
35+
environment: ${{ inputs.graph_environment }}
3636
steps:
3737
- name: Harden Runner
3838
uses: step-security/harden-runner@1b05615854632b887b69ae1be8cbefe72d3ae423 # v2.5.0
3939
with:
4040
egress-policy: audit
4141

42+
- name: Validate Network environment variable
43+
if: ${{!startsWith(vars.NETWORK, 'arbitrum')}}
44+
run: echo ${{vars.NETWORK}} && exit 1
45+
4246
- name: Checkout code
4347
uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
4448

@@ -66,7 +70,7 @@ jobs:
6670
if: ${{ inputs.update }}
6771
run: |
6872
export PATH=$PWD/../bin:$PATH
69-
yarn update:${{ inputs.subgraph }}:${{ inputs.network }}
73+
yarn update:${{ inputs.subgraph }}:${{ vars.NETWORK }}
7074
working-directory: subgraph
7175

7276
- name: Build the subgraph
@@ -75,10 +79,10 @@ jobs:
7579
yarn build:${{ inputs.subgraph }}
7680
working-directory: subgraph
7781

78-
- name: Authenticate with TheGraph
79-
run: yarn graph auth "${{ secrets.SUBGRAPH_AUTH_TOKEN }}" --product hosted-service
82+
- name: Authenticate with TheGraph Studio
83+
run: yarn graph auth "${{ secrets.SUBGRAPH_AUTH_TOKEN }}" --studio
8084
working-directory: subgraph
8185

8286
- name: Deploy the subgraph
83-
run: yarn deploy:${{ inputs.subgraph }}:${{ inputs.network }}
87+
run: yarn deploy:${{ inputs.subgraph }}:${{ vars.NETWORK }}
8488
working-directory: subgraph

scripts/act-subgraph.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
#!/usr/bin/env bash
22

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

subgraph/package.json

+5-5
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,9 @@
1010
"build:core": "graph build --output-dir core/build/ core/subgraph.yaml",
1111
"test:core": "cd core && graph test",
1212
"clean:core": "graph clean --codegen-dir core/generated/ --build-dir core/build/ && rm core/subgraph.yaml.bak.*",
13-
"deploy:core:arbitrum-sepolia-devnet": "graph deploy --product subgraph-studio kleros-v2-core-devnet -l v0.0.2 core/subgraph.yaml",
14-
"deploy:core:arbitrum-sepolia": "graph deploy --product subgraph-studio kleros-v2-core-testnet -l v0.0.2 core/subgraph.yaml",
15-
"deploy:core:arbitrum": "graph deploy --product subgraph-studio kleros-v2-core -l v0.0.2 core/subgraph.yaml",
13+
"deploy:core:arbitrum-sepolia-devnet": "graph deploy --product subgraph-studio kleros-v2-core-devnet -l v0.0.3 core/subgraph.yaml",
14+
"deploy:core:arbitrum-sepolia": "graph deploy --product subgraph-studio kleros-v2-core-testnet -l v0.0.3 core/subgraph.yaml",
15+
"deploy:core:arbitrum": "graph deploy --product subgraph-studio kleros-v2-core -l v0.0.3 core/subgraph.yaml",
1616
"": "------------------------------------------------------------------------------------------",
1717
"update:drt:arbitrum-sepolia-devnet": "./scripts/update.sh arbitrumSepoliaDevnet arbitrum-sepolia dispute-template-registry/subgraph.yaml",
1818
"update:drt:arbitrum-sepolia": "./scripts/update.sh arbitrumSepolia arbitrum-sepolia dispute-template-registry/subgraph.yaml",
@@ -22,8 +22,8 @@
2222
"build:drt": "graph build --output-dir dispute-template-registry/generated/ dispute-template-registry/subgraph.yaml",
2323
"test:drt": "cd dispute-template-registry && graph test ",
2424
"clean:drt": "graph clean --codegen-dir dispute-template-registry/generated/ --build-dir dispute-template-registry/build/ && rm dispute-template-registry/subgraph.yaml.bak.*",
25-
"deploy:drt:arbitrum-sepolia-devnet": "graph deploy --product subgraph-studio kleros-v2-drt-arbisep-devnet -l v0.0.2 dispute-template-registry/subgraph.yaml",
26-
"deploy:drt:arbitrum-sepolia": "graph deploy --product subgraph-studio kleros-v2-drt-arbisep-testnet -l v0.0.2 dispute-template-registry/subgraph.yaml",
25+
"deploy:drt:arbitrum-sepolia-devnet": "graph deploy --product subgraph-studio kleros-v2-drt-arbisep-devnet -l v0.0.3 dispute-template-registry/subgraph.yaml",
26+
"deploy:drt:arbitrum-sepolia": "graph deploy --product subgraph-studio kleros-v2-drt-arbisep-testnet -l v0.0.3 dispute-template-registry/subgraph.yaml",
2727
" ": "-----------------------------------------------------------------------------------------",
2828
"update:arbitrum-sepolia-devnet": "./scripts/all.sh update arbitrum-sepolia-devnet",
2929
"update:arbitrum-sepolia": "./scripts/all.sh update arbitrum-sepolia",

0 commit comments

Comments
 (0)