forked from KlimaDAO/klima-subgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
83 lines (76 loc) · 3.06 KB
/
deploy.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
name: Deployment
on:
push:
branches:
- main
- staging
jobs:
compile:
runs-on: ubuntu-latest
name: Deploy
strategy:
matrix:
value:
[
'bonds',
'carbonmark',
'protocol-metrics',
'vesting',
'user-carbon',
'pairs',
'celo-bridged-carbon',
'ethereum-bridged-carbon',
'polygon-bridged-carbon',
'polygon-digital-carbon',
]
steps:
- name: Check out source repository
uses: actions/checkout@v2
- name: Setup Node
uses: actions/setup-node@v2
with:
node-version: '16'
- name: Install dependencies
run: yarn --frozen-lockfile
working-directory: '${{ matrix.value }}'
# Generate code and check for uncommitted changes
# https://github.com/marketplace/actions/check-uncommitted-changes
- name: Generate Subgraph Code
run: npm run codegen
working-directory: '${{ matrix.value }}'
- name: Check for uncommitted changes
id: check-changes
uses: mskri/[email protected]
- name: Evaluate if there are changes
if: steps.check-changes.outputs.outcome == failure()
run: echo "There are uncommitted changes - execute 'npm run codegen' locally and commit the generated files!"
- name: Build Subgraph
run: npm run build
working-directory: '${{ matrix.value }}'
# TODO: add matchstick test suite
# - name: Run Tests
# run: npm run test
# working-directory: "${{ matrix.value }}"
- name: Staging or not
id: staging_or_not
run: |
echo "short_sha=$(git rev-parse --short "$GITHUB_SHA")" >> $GITHUB_OUTPUT
if [ $REF == "refs/heads/staging" ]
then
PREFIX="staging-"
fi;
if [[ "${{ matrix.value }}" =~ .*"-".*"-carbon".* ]]
then
echo "subgraph=${PREFIX}${{ matrix.value }}" >> $GITHUB_OUTPUT
else
echo "subgraph=${PREFIX}klimadao-${{ matrix.value }}" >> $GITHUB_OUTPUT
fi
env:
REF: ${{ github.ref }}
- name: Deploy Subgraph to Studio
run: ../node_modules/.bin/graph deploy --studio --deploy-key ${{ secrets.SUBGRAPH_STUDIO_DEPLOY_KEY }} ${{ steps.staging_or_not.outputs.subgraph }} --version-label ${{ steps.staging_or_not.outputs.short_sha }}
working-directory: '${{ matrix.value }}'
- name: Deploy Subgraph to Alchemy Hosted Service
if: ${{ matrix.value == 'carbonmark' || matrix.value == 'polygon-digital-carbon' || matrix.value == 'pairs' || matrix.value == 'ethereum-bridged-carbon'}}
run: ../node_modules/.bin/graph deploy ${{ steps.staging_or_not.outputs.subgraph }} --deploy-key ${{ secrets.SUBGRAPH_ALCHEMY_HOSTED_SERVICE_DEPLOY_KEY }} --node https://subgraphs.alchemy.com/api/subgraphs/deploy --ipfs https://ipfs.satsuma.xyz --version-label ${{ steps.staging_or_not.outputs.short_sha }}
working-directory: '${{ matrix.value }}'