|
| 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 |
0 commit comments