Skip to content

Deploy

Deploy #14

Workflow file for this run

name: Deploy
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: The version's tag to deploy
required: true
type: string
concurrency:
group: deploy-${{ github.ref }}
cancel-in-progress: true
jobs:
check-permissions:
runs-on: ubuntu-22.04
steps:
- name: Not authorized
if: ${{ github.event_name == 'workflow_dispatch' && github.actor != env.AUTH_USER }}
run: |
echo "Error: Only $AUTH_USER can trigger this workflow."
exit 1
env:
AUTH_USER: "bot-anik"
deploy-on-ipfs:
runs-on: ubuntu-22.04
needs:
- check-permissions
env:
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQL_ACCESS_TOKEN }}
outputs:
ipfs-cid: ${{ steps.ipfs-upload.outputs.ipfs-cid }}
steps:
- name: Setup node environment (for deployment)
uses: actions/setup-node@v4
with:
node-version: 18.16
- name: Check out repository
uses: actions/checkout@v4
with:
ref: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.tag || github.ref }}
- name: Patch startBlock to 1
uses: mikefarah/[email protected]
with:
cmd: yq eval ".dataSources[].startBlock = env(START_BLOCK)" project.yaml -i
env:
START_BLOCK: 1
- name: Fetch dependencies
run: |
yarn --frozen-lockfile
- name: Generate code
run: |
yarn codegen
- name: Build project
run: |
yarn build
- name: Upload to IPFS
id: ipfs-upload
run: |
yarn subql publish
IPFS_CID=$(cat .project-cid)
echo "πŸš€ Uploaded to IPFS: ${IPFS_CID}"
echo "ipfs-cid=${IPFS_CID}" >> $GITHUB_OUTPUT
deploy-on-subquery-managed-service:
runs-on: ubuntu-22.04
needs:
- check-permissions
- deploy-on-ipfs
env:
SUBQL_ACCESS_TOKEN: ${{ secrets.SUBQL_ACCESS_TOKEN }}
IPFS_CID: ${{ needs.deploy-on-ipfs.outputs.ipfs-cid }}
strategy:
max-parallel: 1
matrix:
project:
- org: "okp4"
name: "nemeton-1"
endpoint: "https://api.testnet.okp4.network/rpc"
steps:
- name: Setup node environment (for deployment)
uses: actions/setup-node@v4
with:
node-version: 18.16
- name: Check out repository
uses: actions/checkout@v4
- name: Fetch dependencies
run: |
yarn --frozen-lockfile
- name: Deploy to SubQuery Managed service (${{ matrix.project.name }})
run: |
yarn subql deployment:deploy \
-d \
--disableHistorical \
--ipfsCID="$IPFS_CID" \
--projectName="${{ matrix.project.name }}" \
--org="${{ matrix.project.org }}" \
--endpoint="${{ matrix.project.endpoint }}"