-
Notifications
You must be signed in to change notification settings - Fork 0
89 lines (73 loc) · 2.66 KB
/
thegraph_dev_deploy.yml
File metadata and controls
89 lines (73 loc) · 2.66 KB
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
name: The Graph - Manual Deployment to Dev
on:
workflow_dispatch:
inputs:
network:
description: "Network for Subgraph deployment - (Gnosis Chain or Ethereum)"
required: true
options:
- Ethereum
- Gnosis Chain
type: choice
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
deploy:
name: Deployment
runs-on: ubuntu-latest
defaults:
run:
shell: bash
working-directory: ./subgraph
outputs:
random_id: ${{ steps.random_id.outputs.random_id }}
steps:
- uses: actions/checkout@v4
- uses: actions/cache@v4
with:
path: '**/node_modules'
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
- name: Check for excluded branches
if: startsWith(github.ref, 'refs/heads/main')
run: |
echo "This branch is excluded from workflow dispatch."
exit 1
- name: Generate Random ID
id: random_id
run: |
echo "random_id=$(openssl rand -hex 4)" >> $GITHUB_OUTPUT
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version-file: '.nvmrc'
- name: Install graph-cli & dependencies
run: |
yarn install
- name: Build Subgraph
run: yarn codegen && yarn build
- name: Authenticate to Subgraph Studio
run: graph auth --studio ${{ secrets.THEGRAPH_DEPLOY_API_KEY }}
- name: Deploy Subgraph for ETH Mainnet
if: ${{ inputs.network == 'Ethereum' }}
env:
SUBGRAPH_NAME: gbc-bridge-mainnet
ACCESS_TOKEN: ${{ secrets.THEGRAPH_DEPLOY_API_KEY }}
run: yarn deploy -l "${{ github.ref_name }}-${{ steps.random_id.outputs.random_id }}"
- name: Deploy Subgraph for Gnosis Chain
if: ${{ inputs.network == 'Gnosis Chain' }}
env:
SUBGRAPH_NAME: gbc-bridge-gnosis
ACCESS_TOKEN: ${{ secrets.THEGRAPH_DEPLOY_API_KEY }}
run: yarn deploy -l "${{ github.ref_name }}-${{ steps.random_id.outputs.random_id }}"
notify:
uses: ./.github/workflows/slack_release_notification.yml
if: ${{ always() }}
needs: deploy
secrets:
RELEASES_SLACK_WEBHOOK_URL: ${{ secrets.RELEASES_SLACK_WEBHOOK_URL }}
with:
environment: Development
service: Bridge Monitor SubGraph
success: ${{ contains(join(needs.*.result, ','), 'success') }}
message: "deploy service `Bridge Monitor SubGraph` version `${{ github.ref_name }}-${{ needs.deploy.outputs.random_id }}`. Triggered by `${{ github.actor }}`."