Skip to content

feat: implement squid height context #194

feat: implement squid height context

feat: implement squid height context #194

Workflow file for this run

name: build
on:
workflow_dispatch: {}
push:
branches: [ main, develop ]
env:
PROJECT_ID: bright-meridian-316511
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
network: [mainnet, tethys]
steps:
# - name: cancel previous runs
# uses: styfle/[email protected]
# with:
# access_token: ${{ github.token }}
- name: Checkout
uses: actions/checkout@v2
- name: Install node
uses: actions/setup-node@v4
with:
node-version: 18
- name: Install Yarn
run: corepack enable
# Yarn dependencies cannot be cached until yarn is installed
# WORKAROUND: https://github.com/actions/setup-node/issues/531
- name: Extract cached dependencies
uses: actions/setup-node@v4
with:
cache: yarn
- name: env
id: env
run: |
echo "::set-output name=tag::$(git rev-parse --short HEAD)"
if [ "$REF" = "refs/heads/main" ]; then
echo "::set-output name=app_env::prod"
echo "::set-output name=testnet_squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/graphql"
echo "::set-output name=mainnet_squid_api_url::https://subsquid.squids.live/subsquid-network-mainnet/graphql"
echo "::set-output name=enable_demo_features::false"
else
echo "::set-output name=app_env::dev"
echo "::set-output name=testnet_squid_api_url::https://subsquid.squids.live/subsquid-network-testnet/v/v3/graphql"
echo "::set-output name=mainnet_squid_api_url::https://subsquid.squids.live/subsquid-network-mainnet/v/v3/graphql"
echo "::set-output name=enable_demo_features::true"
fi
if [ "$NETWORK" = "mainnet" ]; then
echo "::set-output name=wc_project_id::475eff0658d0f3300ca18971418d261b"
else
echo "::set-output name=wc_project_id::ec2facac9eaaca7cc0584baadc935c01"
fi
env:
REF: ${{ github.ref }}
NETWORK: ${{ matrix.network }}
- run: yarn install --immutable
# Check compile errors before build
- run: yarn tsc
- run: yarn build
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
APP_VERSION: ${{ steps.env.outputs.tag }}
WALLET_CONNECT_PROJECT_ID: ${{ steps.env.outputs.wc_project_id }}
ENABLE_DEMO_FEATURES: ${{ steps.env.outputs.enable_demo_features }}
NETWORK: ${{ matrix.network }}
TESTNET_SQUID_API_URL: ${{ steps.env.outputs.testnet_squid_api_url }}
MAINNET_SQUID_API_URL: ${{ steps.env.outputs.mainnet_squid_api_url }}
# Build and push images to Google Container Registry
- name: Build image
run: docker build --progress=plain -t "gcr.io/${PROJECT_ID}/subsquid-network-app-${NETWORK}-${APP_ENV}:${TAG}" -t "gcr.io/${PROJECT_ID}/subsquid-network-app-${NETWORK}-${APP_ENV}:latest" .
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
NETWORK: ${{ matrix.network }}
TAG: ${{ steps.env.outputs.tag }}
- id: auth
uses: google-github-actions/[email protected]
with:
credentials_json: ${{ secrets.GCP_SERVICE_ACCOUNT_KEY }}
- name: Set up Cloud SDK
uses: google-github-actions/[email protected]
# steps for push images to gcr
- name: 'gcloud cli --> docker credential helper'
run: gcloud auth configure-docker -q
- name: Push image
run: |
docker push "gcr.io/${PROJECT_ID}/subsquid-network-app-${NETWORK}-${APP_ENV}:${TAG}"
docker push "gcr.io/${PROJECT_ID}/subsquid-network-app-${NETWORK}-${APP_ENV}:latest"
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
NETWORK: ${{ matrix.network }}
TAG: ${{ steps.env.outputs.tag }}