-
Notifications
You must be signed in to change notification settings - Fork 45
92 lines (77 loc) · 3.34 KB
/
template-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
84
85
86
87
88
89
90
91
92
name: Production Subgraph (Mainnet)
on:
workflow_call:
inputs:
ENVIRONMENT:
required: false
type: string
default: 'testnet'
CONFIG:
required: true
type: string
default: mainnetAddressScript.ts
secrets:
NODE_AUTH_TOKEN:
required: true
ACCESS_TOKEN:
required: true
jobs:
template-deploy:
runs-on: ubuntu-latest
steps:
- name: Set arbitrum staging environment variables
if: ${{ inputs.ENVIRONMENT == 'staging-arbitrum' }}
run: |
echo "ENV_SUFFIX=graph-network-arbitrum-staging" >> $GITHUB_ENV
- name: Set mainnet staging environment variables
if: ${{ inputs.ENVIRONMENT == 'staging-mainnet' }}
run: |
echo "ENV_SUFFIX=graph-network-mainnet-staging" >> $GITHUB_ENV
- name: Set mainnet environment variables
if: ${{ inputs.ENVIRONMENT == 'production' }}
run: |
echo "ENV_SUFFIX=graph-network-mainnet" >> $GITHUB_ENV
- name: Set arbitrum environment variables
if: ${{ inputs.ENVIRONMENT == 'production-arbitrum' }}
run: |
echo "ENV_SUFFIX=graph-network-arbitrum" >> $GITHUB_ENV
- name: Set goerli production environment variables
if: ${{ inputs.ENVIRONMENT == 'production-goerli' }}
run: |
echo "ENV_SUFFIX=graph-network-goerli" >> $GITHUB_ENV
- name: Set arbitrum goerli production environment variables
if: ${{ inputs.ENVIRONMENT == 'production-arbitrum-goerli' }}
run: |
echo "ENV_SUFFIX=graph-network-arbitrum-goerli" >> $GITHUB_ENV
echo "IPFS_SUFFIX=" >> $GITHUB_ENV
- name: Set goerli production environment variables
if: ${{ inputs.ENVIRONMENT == 'production-sepolia' }}
run: |
echo "ENV_SUFFIX=graph-network-sepolia" >> $GITHUB_ENV
echo "IPFS_SUFFIX=" >> $GITHUB_ENV
- name: Set arbitrum goerli production environment variables
if: ${{ inputs.ENVIRONMENT == 'production-arbitrum-sepolia' }}
run: |
echo "ENV_SUFFIX=graph-network-arbitrum-sepolia" >> $GITHUB_ENV
echo "IPFS_SUFFIX=" >> $GITHUB_ENV
- name: Checkout
uses: actions/checkout@v3
# Install commands
- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'
registry-url: https://registry.npmjs.org
- name: yarn add ts-node
run: yarn add ts-node
- name: yarn install
run: yarn install
env:
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
# Run scripts
- name: Prepare addresses ${{ inputs.ENVIRONMENT }}
run: ./node_modules/.bin/ts-node config/${{ inputs.CONFIG }} && ./node_modules/.bin/mustache ./config/generatedAddresses.json ./config/addresses.template.ts > ./config/addresses.ts
- name: Prepare ${{ inputs.ENVIRONMENT }}
run: ./node_modules/.bin/mustache ./config/generatedAddresses.json subgraph.template.yaml > subgraph.yaml && ./node_modules/@graphprotocol/graph-cli/bin/run codegen --output-dir src/types/
- name: Deploy to ${{ inputs.ENVIRONMENT }}
run: ./node_modules/@graphprotocol/graph-cli/bin/run deploy graphprotocol/${{ env.ENV_SUFFIX }} --ipfs https://api.thegraph.com/ipfs/ --node https://api.thegraph.com/deploy/ --access-token ${{ secrets.ACCESS_TOKEN }}