forked from reflexer-labs/geb-subgraph
-
Notifications
You must be signed in to change notification settings - Fork 0
55 lines (51 loc) · 1.74 KB
/
deploy-mainnet.yml
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
on:
push:
branches:
- master
name: Deploy mainnet
jobs:
deploy:
name: Deploy Mainnet
runs-on: ubuntu-latest
if: "!contains(github.event.head_commit.message, '#no-ci')"
steps:
- name: executing remote ssh commands using ssh key
uses: appleboy/ssh-action@master
env:
ETHEREUM_RPC: ${{secrets.ETHEREUM_RPC_MAINNET}}
POSTGRES_PASSWORD: ${{secrets.POSTGRES_PASSWORD}}
NETWORK: 'mainnet'
GRAPH_HOSTED_SERVICE_AUTH_TOKEN: ${{secrets.GRAPH_HOSTED_SERVICE_AUTH_TOKEN}}
with:
host: ${{secrets.DEPLOY_MAINNET_URL}}
username: ubuntu
key: ${{secrets.SSH_PRIVATE_KEY}}
port: 22
envs: ETHEREUM_RPC,POSTGRES_PASSWORD,NETWORK,GRAPH_HOSTED_SERVICE_AUTH_TOKEN
script: |
export NVM_DIR=~/.nvm
source ~/.nvm/nvm.sh
if docker container ls | grep -q graph-node
then
echo "Redeploy subgraph only..."
cd geb-subgraph/docker
git fetch
git checkout origin/master
sudo chmod -R +rwx data/
docker-compose up --build graph-deployer
else
echo "Redeploy all..."
docker stop $(docker ps -aq)
docker rm $(docker ps -aq)
sudo rm -rf geb-subgraph
git clone https://github.com/reflexer-labs/geb-subgraph
cd geb-subgraph/docker
git checkout master
echo ETHEREUM_RPC=$ETHEREUM_RPC >> .env
echo NETWORK=$NETWORK >> .env
echo POSTGRES_PASSWORD=$POSTGRES_PASSWORD >> .env
docker-compose up --build -d
fi
# Deploy on the hosted service
npm install
npm run deploy-hosted-mainnet -- --access-token $GRAPH_HOSTED_SERVICE_AUTH_TOKEN