Skip to content

Commit ed36635

Browse files
committed
chore: subgraph deployment automation
1 parent 42cb23e commit ed36635

File tree

3 files changed

+55
-4
lines changed

3 files changed

+55
-4
lines changed

.github/workflows/deploy-subgraph.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Deploy the Subgraph
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
network:
7+
description: The network to deploy the subgraph to
8+
required: true
9+
default: 'arbitrum-goerli'
10+
type: choice
11+
options:
12+
- arbitrum-goerli
13+
- arbitrum
14+
15+
permissions:
16+
contents: read
17+
18+
jobs:
19+
buildAndDeploy:
20+
runs-on: ubuntu-latest
21+
environment: kleros-org-subgraph
22+
steps:
23+
- name: Harden Runner
24+
uses: step-security/harden-runner@128a63446a954579617e875aaab7d2978154e969 # v2.4.0
25+
with:
26+
egress-policy: audit
27+
28+
- name: Checkout code
29+
uses: actions/checkout@ee0669bd1cc54295c223e0bb666b733df41de1c5 # v2.7.0
30+
31+
- name: Set up Node.js
32+
uses: actions/setup-node@7c12f8017d5436eb855f1ed4399f037a36fbd9e8 # v2.5.2
33+
with:
34+
node-version: 16
35+
36+
- name: Install the dependencies
37+
run: yarn install
38+
39+
- name: Build the subgraph
40+
run: |
41+
yarn codegen
42+
yarn build
43+
44+
- name: Authenticate with TheGraph
45+
run: yarn graph auth "${{ secrets.SUBGRAPH_AUTH_TOKEN }}" --product hosted-service
46+
47+
- name: Deploy the subgraph
48+
run: yarn deploy:${{ inputs.network }}

subgraph/README.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@
1010
## Build
1111

1212
```bash
13-
$ yarn
13+
# update subgraph.yml using the contract deployment artifacts
14+
$ yarn update:arbitrum-goerli
1415

1516
$ yarn codegen
1617

@@ -30,5 +31,5 @@ $ yarn run graph auth --product hosted-service
3031
### Deployment
3132

3233
```bash
33-
yarn deploy
34+
yarn deploy:arbitrum-goerli
3435
```

subgraph/package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,12 @@
22
"name": "@kleros/kleros-v2-subgraph",
33
"license": "MIT",
44
"scripts": {
5-
"update": "./scripts/update.sh",
5+
"update:arbitrum-goerli": "./scripts/update.sh arbitrumGoerli arbitrum-goerli",
6+
"update:arbitrum": "./scripts/update.sh arbitrum arbitrum",
67
"codegen": "graph codegen",
78
"build": "graph build",
8-
"deploy": "graph deploy --product hosted-service kleros/kleros-v2-core-arbitrum-goerli",
9+
"deploy:arbitrum-goerli": "graph deploy --product hosted-service kleros/kleros-v2-core-arbitrum-goerli",
10+
"deploy:arbitrum": "graph deploy --product hosted-service kleros/kleros-v2-core-arbitrum",
911
"create-local": "graph create --node http://localhost:8020/ kleros/kleros-v2-core-local",
1012
"remove-local": "graph remove --node http://localhost:8020/ kleros/kleros-v2-core-local",
1113
"deploy-local": "graph deploy --node http://localhost:8020/ --ipfs http://localhost:5001 kleros/kleros-v2-core-local --version-label v$(date +%s)",

0 commit comments

Comments
 (0)