-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (125 loc) · 4.59 KB
/
subql_multi_deploy_workflow.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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
on:
workflow_call:
inputs:
chainId:
required: true
type: string
projOrg:
required: true
type: string
projImage:
required: false
type: string
deploymentType:
description: stage or primary
required: false
type: string
default: stage
resetProject:
default: false
type: boolean
secrets:
accessToken:
required: true
onfinalityApiKey:
required: true
jobs:
subql_deploy_workflow:
runs-on: ubuntu-latest
env:
SUBQL_CFG_INDEXER_VERSION: "v5.2.9"
SUBQL_ETH_INDEXER_VERSION: "v5.1.7"
CHAIN_ID: ${{ inputs.chainId }}
SUBQL_ACCESS_TOKEN: ${{ secrets.accessToken }}
SUBQL_PROJ_ORG: ${{ inputs.projOrg }}
SUBQL_PROJ_IMAGE: ${{ inputs.projImage }}
SUBQL_DEPLOYMENT_TYPE: ${{ inputs.deploymentType }}
ONFINALITY_API_KEY: ${{ secrets.onfinalityApiKey }}
environment: ${{ inputs.chainId == 'centrifuge' && 'pools-multichain' || format('pools-{0}-multichain', inputs.chainId) }}
steps:
- name: Check out repo's default branch
uses: actions/checkout@v3
- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Setup Yarn
run: yarn install --frozen-lockfile
- name: Codegen
run: |
CHAIN_ID=centrifuge yarn projectgen
yarn codegen
- name: SubQL CLI Version
run: yarn subql --version
- name: Generate new project data
run: 'yarn projectgen'
- name: Extract Chain Parameters to ENV
run: |
SUBQL_ENDPOINTS=""
SUBQL_DICTIONARIES=""
SUBQL_VERSIONS=""
for projectFile in project-*.yaml; do
echo "Reading $projectFile"
chainId=$(yq '.network.chainId' $projectFile)
endpoint=$(yq '.network.endpoint' $projectFile)
dictionary=$(yq '.network.dictionary' $projectFile)
if [[ -n "$SUBQL_ENDPOINTS" ]]; then SUBQL_ENDPOINTS+=","; fi
SUBQL_ENDPOINTS+="${chainId}:${endpoint}"
if [[ -n "$SUBQL_ENDPOINTS" ]]; then SUBQL_ENDPOINTS+=","; fi
SUBQL_ENDPOINTS+="${chainId}:${endpoint}"
if [[ "$dictionary" != "null" ]]; then
if [[ -n "$SUBQL_DICTIONARIES" ]]; then SUBQL_DICTIONARIES+=","; fi
SUBQL_DICTIONARIES+="${chainId}:${dictionary}"
fi
if [[ -n "$SUBQL_CFG_INDEXER_VERSION" && -n "$SUBQL_ETH_INDEXER_VERSION" ]]; then
if [[ -n "$SUBQL_VERSIONS" ]]; then SUBQL_VERSIONS+=","; fi
if [[ "${chainId:0:2}" == "0x" ]]; then
SUBQL_VERSIONS+="${chainId}:${SUBQL_CFG_INDEXER_VERSION}"
else
SUBQL_VERSIONS+="${chainId}:${SUBQL_ETH_INDEXER_VERSION}"
fi
fi
done
echo "SUBQL_PROJ_NAME=$(yq '.name' project-centrifuge.yaml)-multichain" >> $GITHUB_ENV
echo "SUBQL_PROJ_DECRIPTION=$(yq '.description' project-centrifuge.yaml)" >> $GITHUB_ENV
echo "SUBQL_ENDPOINTS=${SUBQL_ENDPOINTS}" >> $GITHUB_ENV
echo "SUBQL_DICTIONARIES=${SUBQL_DICTIONARIES}" >> $GITHUB_ENV
echo "SUBQL_VERSIONS=${SUBQL_VERSIONS}" >> $GITHUB_ENV
- name: Publish SubQL version
run: |
echo "IPFSCID=$(node_modules/.bin/subql publish -o)" >> $GITHUB_ENV
- name: Delete Project
if: ${{ inputs.resetProject }}
run: |
npx subql project:delete-project \
--org="$SUBQL_PROJ_ORG" \
--projectName="$SUBQL_PROJ_NAME"
continue-on-error: true
- name: Create Project
if: ${{ inputs.resetProject }}
run: |
npx subql project:create-project \
--apiVersion=2 \
--description="$SUBQL_PROJ_DESCRIPTION" \
--gitRepo="https://github.com/$GITHUB_REPOSITORY" \
--org="$SUBQL_PROJ_ORG" \
--projectName="$SUBQL_PROJ_NAME" \
--logoURL="$SUBQL_PROJ_IMAGE"
- name: Deploy Multichain Version
run: |
npx subql multi-chain:deploy \
-d \
--location=./subquery-multichain.yaml \
--org="$SUBQL_PROJ_ORG" \
--projectName="$SUBQL_PROJ_NAME" \
--endpoint="$SUBQL_ENDPOINTS" \
--dict="$SUBQL_DICTIONARIES" \
--type=$SUBQL_DEPLOYMENT_TYPE \
--disableHistorical \
--disableIndexerStoreCacheAsync \
--queryLimit=1000 \
--indexerWorkers=0 \
--indexerUnsafe \
--indexerVersion="$SUBQL_VERSIONS" \
--queryAggregate