forked from humanprotocol/human-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
76 lines (74 loc) · 2.5 KB
/
cd-subgraph.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
name: Subgraph deployment
on:
workflow_dispatch:
inputs:
label:
description: 'New version label'
required: true
networks:
description: 'Comma-separated list of networks to deploy'
required: true
jobs:
subgraph:
name: Deploy Subgraph
runs-on: ubuntu-latest
strategy:
matrix:
network:
- name: amoy
- name: bsc-testnet
- name: bsc
- name: ethereum
- name: polygon
- name: sepolia
fail-fast: true
max-parallel: 3
steps:
- uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v3
with:
node-version: '18.20.1'
- name: Filter Networks
id: filter_networks
run: |
INPUT_NETWORKS="${{ github.event.inputs.networks }}"
IFS=',' read -ra NETWORK_LIST <<< "$INPUT_NETWORKS"
echo "Input networks: $INPUT_NETWORKS"
echo "Current matrix network: ${{ matrix.network.name }}"
MATCH=false
for network in "${NETWORK_LIST[@]}"; do
if [[ "${network}" == "${{ matrix.network.name }}" ]]; then
MATCH=true
break
fi
done
echo "Match found: $MATCH"
echo "::set-output name=continue::$MATCH"
- run: npm install --global yarn && yarn
name: Install dependencies
if: steps.filter_networks.outputs.continue == 'true'
- run: yarn build
name: Build core package
working-directory: ./packages/core
if: steps.filter_networks.outputs.continue == 'true'
- run: yarn global add @graphprotocol/[email protected]
name: Install Graph CLI
if: steps.filter_networks.outputs.continue == 'true'
- run: graph auth --studio ${API_KEY}
name: Authenticate Graph CLI
env:
API_KEY: ${{ secrets.HP_GRAPH_API_KEY }}
if: steps.filter_networks.outputs.continue == 'true'
- run: yarn generate && yarn build
name: Generate and build Subgraph
working-directory: ./packages/sdk/typescript/subgraph
env:
NETWORK: ${{ matrix.network.name }}
if: steps.filter_networks.outputs.continue == 'true'
- run: graph deploy --studio ${NETWORK} -l ${{ github.event.inputs.label }}
name: Deploy Subgraph
working-directory: ./packages/sdk/typescript/subgraph
env:
NETWORK: ${{ matrix.network.name }}
if: steps.filter_networks.outputs.continue == 'true'