Skip to content

initial commit

initial commit #1

Workflow file for this run

name: build
on:
workflow_dispatch: {}
push:
branches: [ main, develop ]
env:
PROJECT_ID: ${{ secrets.GCP_PROJECT }}
jobs:
build:
runs-on: ubuntu-latest
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=wc_project_id::475eff0658d0f3300ca18971418d261b"
echo "::set-output name=enable_demo_features::false"
echo "::set-output name=squid_api_url::https://squid.subsquid.io/subsquid-network-indexer/v/v7/graphql"
echo "::set-output name=app_domain::app.subsquid.io"
else
echo "::set-output name=app_env::dev"
echo "::set-output name=wc_project_id::ec2facac9eaaca7cc0584baadc935c01"
echo "::set-output name=enable_demo_features::true"
echo "::set-output name=squid_api_url::https://squid.subsquid.io/subsquid-network-indexer/v/v7/graphql"
echo "::set-output name=app_domain::app.devsquid.net"
fi
env:
REF: ${{ github.ref }}
- run: yarn install --immutable
- 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: ${{ steps.env.outputs.network }}
SQUID_API_URL: ${{ steps.env.outputs.squid_api_url }}
# SENTRY_DSN: ${{ steps.env.outputs.sentry_dsn }}
USER_API_URL: /api
AQUARIUM_API_URL: /api
NETWORK_API_URL: /network/api
# Build and push images to Google Container Registry
- name: Build image
run: docker build --progress=plain -t "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:${TAG}" -t "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:latest" .
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
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-${APP_ENV}:${TAG}"
docker push "gcr.io/${PROJECT_ID}/subsquid-network-app-${APP_ENV}:latest"
env:
APP_ENV: ${{ steps.env.outputs.app_env }}
TAG: ${{ steps.env.outputs.tag }}