Skip to content

Commit 103fbef

Browse files
committed
feat: add deploy workflow for TheGraph Network
1 parent 5ca5d6c commit 103fbef

File tree

2 files changed

+62
-10
lines changed

2 files changed

+62
-10
lines changed
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Deploy Subgraph - on TheGraph Network
2+
3+
on:
4+
workflow_dispatch: # Triggered manually but we can also trigger with an release event
5+
inputs:
6+
environment:
7+
description: 'Deployment environment (must match a GitHub Environment name)'
8+
required: true
9+
default: staging
10+
type: choice
11+
options:
12+
- staging
13+
- tmp
14+
- prod
15+
16+
jobs:
17+
deploy:
18+
runs-on:
19+
group: Azure_runners
20+
labels: [ self-hosted, Linux, X64 ]
21+
# Associate the job with a GitHub Environment which has pre-defined variables and secrets.
22+
environment: ${{ github.event.inputs.environment }}
23+
steps:
24+
- uses: actions/checkout@v4
25+
- uses: actions/setup-node@v4
26+
with:
27+
node-version: '20'
28+
29+
- name: Install dependencies
30+
working-directory: packages/subgraph
31+
run: npm ci
32+
33+
- name: Set Version Label
34+
working-directory: packages/subgraph
35+
id: set_version
36+
run: |
37+
if [[ "${{ github.event.inputs.environment }}" == "staging" ]]; then
38+
echo "version=${GITHUB_SHA}" >> $GITHUB_OUTPUT
39+
else
40+
version=$(npm pkg get version | sed 's/"//g')
41+
echo "version=$version" >> $GITHUB_OUTPUT
42+
fi
43+
44+
- name: Deploy Subgraph
45+
working-directory: packages/subgraph
46+
env:
47+
NETWORK_NAME: bellecour
48+
VERSION_LABEL: ${{ steps.set_version.outputs.version }}
49+
GRAPHNODE_URL: ${{ vars.GRAPHNODE_URL }}
50+
IPFS_URL: ${{ vars.IPFS_URL }}
51+
DEPLOY_ENV: ${{ vars.ENV_NAME }}
52+
run: |
53+
echo "Starting deployment with the following parameters:"
54+
echo " Network Name: $NETWORK_NAME"
55+
echo " Version Label: $VERSION_LABEL"
56+
echo " DEPLOY_ENV: $DEPLOY_ENV"
57+
echo " GRAPHNODE_URL: $GRAPHNODE_URL"
58+
echo " IPFS_URL: $IPFS_URL"
59+
npm run all
60+
shell: bash

.github/workflows/deploy-subgraph.yml

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Deploy Subgraph
1+
name: Deploy Subgraph - on self-hosted node
22

33
on:
44
workflow_dispatch: # Triggered manually but we can also trigger with an release event
@@ -12,14 +12,6 @@ on:
1212
- staging
1313
- tmp
1414
- prod
15-
# Add new networks when needed. Do not forget to add necessary data in the networks.json file.
16-
networkName:
17-
description: 'Network Name'
18-
required: false
19-
default: bellecour
20-
type: choice
21-
options:
22-
- bellecour
2315

2416
jobs:
2517
deploy:
@@ -52,7 +44,7 @@ jobs:
5244
- name: Deploy Subgraph
5345
working-directory: packages/subgraph
5446
env:
55-
NETWORK_NAME: ${{ github.event.inputs.networkName }}
47+
NETWORK_NAME: bellecour
5648
VERSION_LABEL: ${{ steps.set_version.outputs.version }}
5749
GRAPHNODE_URL: ${{ vars.GRAPHNODE_URL }}
5850
IPFS_URL: ${{ vars.IPFS_URL }}

0 commit comments

Comments
 (0)