Fixing the Quest Chains minting process #624
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy Preview to Cloud Run | |
on: | |
workflow_dispatch: | |
inputs: | |
cache_key: | |
description: Optional cache key component to force invalidation of the build cache. | |
required: false | |
default: "" | |
pull_request: | |
types: | |
- opened | |
- reopened | |
- synchronize | |
env: | |
# This controls whether the Next.js runs in development or | |
# production mode. For debugging test instance only bugs. | |
FRONTEND_TARGET: production # development | |
PROJECT_ID: metagame-thegame | |
REGISTRY_REGION: us-east4 | |
REGISTRY_REPO: thegame | |
DEPLOYMENT_DOMAIN: a.run.app | |
CLOUDRUN_SUFFIX: mjhnbmqqna-uk | |
DEPLOYMENT_NAME: Test-PR-${{github.event.number}} | |
DB_NAME: hasura-pr-${{github.event.number}} | |
BACKEND_SERVICE: backend-pr-${{github.event.number}} | |
FRONTEND_SERVICE: frontend-pr-${{github.event.number}} | |
BACKEND_PORT: 4000 | |
HASURA_PORT: 8080 | |
FRONTEND_PORT: 3000 | |
HASURA_SECRET: metagame_secret | |
APP_ENV: development | |
jobs: | |
start-deployment: | |
name: Generate Deployment Start Message | |
runs-on: ubuntu-latest | |
outputs: | |
deployment_id: ${{steps.create-message.outputs.deployment_id}} | |
steps: | |
- name: Start Deployment | |
uses: bobheadxi/deployments@v1 | |
id: create-message | |
with: | |
step: start | |
token: ${{github.token}} | |
env: ${{env.DEPLOYMENT_NAME}} | |
desc: "Test instance deployment for PR #${{github.event.number}} of ${{github.event.pull_request.head.label}} by ${{github.event.pull_request.user.login}}" | |
ref: ${{github.head_ref}} | |
auto_inactive: false | |
logs: https://github.com/${{github.repository}}/commit/${{github.event.after}}/checks | |
cancel-previous: | |
name: Cancel Existing Runs | |
runs-on: ubuntu-latest | |
steps: | |
- name: Cancel Existing Runs | |
uses: styfle/cancel-workflow-action@0.12.0 | |
with: | |
access_token: ${{github.token}} | |
env: | |
name: Environment Variables | |
runs-on: ubuntu-latest | |
outputs: | |
APP_ENV: ${{env.APP_ENV}} | |
PROJECT_ID: ${{env.PROJECT_ID}} | |
REGISTRY_REGION: ${{env.REGISTRY_REGION}} | |
REGISTRY_REPO: ${{env.REGISTRY_REPO}} | |
DEPLOYMENT_DOMAIN: ${{env.DEPLOYMENT_DOMAIN}} | |
CLOUDRUN_SUFFIX: ${{env.CLOUDRUN_SUFFIX}} | |
DB_NAME: ${{env.DB_NAME}} | |
BACKEND_SERVICE: ${{env.BACKEND_SERVICE}} | |
FRONTEND_SERVICE: ${{env.FRONTEND_SERVICE}} | |
BACKEND_PORT: ${{env.BACKEND_PORT}} | |
HASURA_PORT: ${{env.HASURA_PORT}} | |
FRONTEND_PORT: ${{env.FRONTEND_PORT}} | |
HASURA_SECRET: ${{env.HASURA_SECRET}} | |
CLOUDRUN_REGION: ${{env.CLOUDRUN_REGION}} | |
CLOUDSQL_INSTANCE_NAME: ${{env.CLOUDSQL_INSTANCE_NAME}} | |
CLOUDSQL_CONNECTION_NAME: ${{env.CLOUDSQL_CONNECTION_NAME}} | |
HASURA_SERVICE: ${{env.HASURA_SERVICE}} | |
DOCKER_REGISTRY: ${{env.DOCKER_REGISTRY}} | |
BACKEND_HOST: ${{env.BACKEND_HOST}} | |
REMOTE_SCHEMA_ENDPOINT: "${{env.BACKEND_URL}}/remote-schemas/graphql" | |
FRONTEND_URL: ${{env.FRONTEND_URL}} | |
DB_PASSWORD: ${{env.DB_PASSWORD}} | |
HASURA_HOST: ${{env.HASURA_HOST}} | |
DOCKER_PATH: ${{env.DOCKER_PATH}} | |
SC_SYNC_URL: ${{env.SC_SYNC_URL}} | |
DB_HOST: ${{env.DB_HOST}} | |
GRAPHQL_URL: ${{env.GRAPHQL_URL}} | |
BACKEND_TAG: ${{env.BACKEND_TAG}} | |
HASURA_TAG: ${{env.HASURA_TAG}} | |
FRONTEND_TAG: ${{env.FRONTEND_TAG}} | |
FRONTEND_TARGET: ${{env.FRONTEND_TARGET}} | |
steps: | |
- name: First Intepolation of Variables | |
id: first | |
run: | | |
echo "CLOUDRUN_REGION=${{env.REGISTRY_REGION}}" >> $GITHUB_ENV | |
echo "CLOUDSQL_INSTANCE_NAME=${{env.REGISTRY_REPO}}" >> $GITHUB_ENV | |
echo "CLOUDSQL_CONNECTION_NAME=\ | |
${{env.PROJECT_ID}}:${{env.REGISTRY_REGION}}:${{env.REGISTRY_REPO}}" >> $GITHUB_ENV | |
echo "HASURA_SERVICE=${{env.DB_NAME}}" >> $GITHUB_ENV | |
echo "DOCKER_REGISTRY=${{env.REGISTRY_REGION}}-docker.pkg.dev" >> $GITHUB_ENV | |
echo "BACKEND_HOST=\ | |
${{env.BACKEND_SERVICE}}-${{env.CLOUDRUN_SUFFIX}}.${{env.DEPLOYMENT_DOMAIN}}" >> $GITHUB_ENV | |
echo "FRONTEND_URL=\ | |
https://${{env.FRONTEND_SERVICE}}-${{env.CLOUDRUN_SUFFIX}}.${{env.DEPLOYMENT_DOMAIN}}" >> $GITHUB_ENV | |
echo "DB_PASSWORD=$(head -c 48 /dev/urandom | tr -cd [:alnum:])" >> $GITHUB_ENV | |
echo "FRONTEND_TARGET=${{env.FRONTEND_TARGET}}" >> $GITHUB_ENV | |
- name: Those Variables May Now Be Interpolated | |
id: second | |
run: | | |
echo "HASURA_HOST=\ | |
${{env.HASURA_SERVICE}}-${{env.CLOUDRUN_SUFFIX}}.${{env.DEPLOYMENT_DOMAIN}}" >> $GITHUB_ENV | |
echo "DOCKER_PATH=\ | |
${{env.DOCKER_REGISTRY}}/${{env.PROJECT_ID}}/${{env.REGISTRY_REPO}}" >> $GITHUB_ENV | |
echo "BACKEND_URL=https://${{env.BACKEND_HOST}}" >> $GITHUB_ENV | |
echo "SC_SYNC_URL=\ | |
https://${{env.BACKEND_HOST}}/actions/syncSourceCredAccounts?force=true" >> $GITHUB_ENV | |
echo "DB_HOST=\ | |
/${{env.DB_NAME}}?host=/cloudsql/${{env.CLOUDSQL_CONNECTION_NAME}}" >> $GITHUB_ENV | |
- name: And That Result Again In Another Step | |
id: third | |
run: | | |
echo "GRAPHQL_URL=\ | |
https://${{env.HASURA_HOST}}/v1/graphql" >> $GITHUB_ENV | |
echo "BACKEND_TAG=\ | |
${{env.DOCKER_PATH}}/backend:pr-${{github.event.number}}" >> $GITHUB_ENV | |
echo "HASURA_TAG=\ | |
${{env.DOCKER_PATH}}/hasura:pr-${{github.event.number}}" >> $GITHUB_ENV | |
echo "FRONTEND_TAG=\ | |
${{env.DOCKER_PATH}}/frontend:pr-${{github.event.number}}" >> $GITHUB_ENV | |
delete-db: | |
name: Delete SQL User & Database | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete SQL User: ${{needs.env.outputs.DB_NAME}}" | |
continue-on-error: true | |
run: | | |
gcloud -q sql users delete ${{needs.env.outputs.DB_NAME}} \ | |
-i ${{needs.env.outputs.CLOUDSQL_INSTANCE_NAME}} | |
- name: "Delete Database: ${{needs.env.outputs.DB_NAME}}" | |
continue-on-error: true | |
run: | | |
wget -q https://dl.google.com/cloudsql/cloud_sql_proxy.linux.amd64 -O cloud_sql_proxy | |
chmod u+x cloud_sql_proxy | |
./cloud_sql_proxy -instances ${{needs.env.outputs.CLOUDSQL_CONNECTION_NAME}} \ | |
-dir /tmp/cloudsql & | |
PID=$! | |
sleep 10 | |
PGPASSWORD=${{secrets.GCP_POSTGRES_PASSWORD}} \ | |
dropdb -h /tmp/cloudsql/${{needs.env.outputs.CLOUDSQL_CONNECTION_NAME}} \ | |
-U postgres ${{needs.env.outputs.DB_NAME}} -f | |
kill $PID | |
create-db: | |
name: Create New SQL User & Database | |
runs-on: ubuntu-latest | |
needs: [env, delete-db] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Create SQL User: ${{needs.env.outputs.DB_NAME}}" | |
run: | | |
gcloud -q sql users create ${{needs.env.outputs.DB_NAME}} \ | |
-i ${{needs.env.outputs.CLOUDSQL_INSTANCE_NAME}} \ | |
--password ${{needs.env.outputs.DB_PASSWORD}} | |
- name: "Create Database: ${{needs.env.outputs.DB_NAME}}" | |
run: | | |
gcloud -q sql databases create ${{needs.env.outputs.DB_NAME}} \ | |
-i ${{needs.env.outputs.CLOUDSQL_INSTANCE_NAME}} | |
undeploy-backend: | |
name: Undeploy Backend | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete Service: ${{needs.env.outputs.BACKEND_SERVICE}}" | |
continue-on-error: true | |
run: | | |
gcloud -q run services delete ${{needs.env.outputs.BACKEND_SERVICE}} \ | |
--region ${{needs.env.outputs.CLOUDRUN_REGION}} | |
delete-backend: | |
name: Delete Backend Container Image | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: "Login to Registry: ${{needs.env.outputs.DOCKER_REGISTRY}}" | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{needs.env.outputs.DOCKER_REGISTRY}} | |
username: _json_key | |
password: ${{secrets.GCP_SA_KEY}} | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete Container Image: ${{needs.env.outputs.BACKEND_TAG}}" | |
continue-on-error: true | |
run: gcloud -q artifacts docker images delete ${{needs.env.outputs.BACKEND_TAG}} | |
build-backend: | |
name: Build Backend Container Image | |
runs-on: ubuntu-latest | |
needs: [env, delete-backend, undeploy-backend] | |
steps: | |
- name: Set Up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to Registry: ${{needs.env.outputs.DOCKER_REGISTRY}}" | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{needs.env.outputs.DOCKER_REGISTRY}} | |
username: _json_key | |
password: ${{secrets.GCP_SA_KEY}} | |
- name: "Build & Push Container Image: ${{needs.env.outputs.BACKEND_TAG}}" | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/backend/Dockerfile | |
tags: ${{needs.env.outputs.BACKEND_TAG}} | |
build-args: | | |
GRAPHQL_URL=${{needs.env.outputs.GRAPHQL_URL}} \ | |
THE_GRAPH_API_TOKEN=${{secrets.THE_GRAPH_API_TOKEN}} | |
push: true | |
deploy-backend: | |
name: Deploy Backend | |
runs-on: ubuntu-latest | |
needs: [env, create-db, build-backend] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Deploy Container Image: ${{needs.env.outputs.BACKEND_TAG}}" | |
run: | | |
gcloud -q run deploy ${{needs.env.outputs.BACKEND_SERVICE}} \ | |
--image ${{needs.env.outputs.BACKEND_TAG}} \ | |
--region ${{needs.env.outputs.CLOUDRUN_REGION}} \ | |
--port ${{needs.env.outputs.BACKEND_PORT}} \ | |
--cpu 1 \ | |
--memory 768Mi \ | |
--ingress all \ | |
--allow-unauthenticated \ | |
--max-instances 1 \ | |
--set-env-vars HASURA_GRAPHQL_ADMIN_SECRET=${{needs.env.outputs.HASURA_SECRET}} \ | |
--set-env-vars GITHUB_API_TOKEN=${{secrets.GH_API_TOKEN}} \ | |
--set-env-vars SOURCECRED_LEDGER_BRANCH=master \ | |
--set-env-vars GRAPHQL_URL=${{needs.env.outputs.GRAPHQL_URL}} \ | |
--set-env-vars DISCORD_BOT_TOKEN=${{secrets.DISCORD_BOT_TOKEN}} \ | |
--set-env-vars THE_GRAPH_API_TOKEN=${{secrets.THE_GRAPH_API_TOKEN}} \ | |
--set-env-vars CERAMIC_URL=https://ceramic.metagame.wtf | |
undeploy-hasura: | |
name: Undeploy Hasura | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete Service: ${{needs.env.outputs.HASURA_SERVICE}}" | |
continue-on-error: true | |
run: | | |
gcloud -q run services delete ${{needs.env.outputs.HASURA_SERVICE}} \ | |
--region ${{needs.env.outputs.CLOUDRUN_REGION}} | |
delete-hasura: | |
name: Delete Hasura Container Image | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: "Login to Registry: ${{needs.env.outputs.DOCKER_REGISTRY}}" | |
uses: docker/login-action@v2 | |
with: | |
registry: ${{needs.env.outputs.DOCKER_REGISTRY}} | |
username: _json_key | |
password: ${{secrets.GCP_SA_KEY}} | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete Container Image: ${{needs.env.outputs.HASURA_TAG}}" | |
continue-on-error: true | |
run: gcloud -q artifacts docker images delete ${{needs.env.outputs.HASURA_TAG}} | |
build-hasura: | |
name: Build Hasura Container Image | |
runs-on: ubuntu-latest | |
needs: [env, delete-hasura, undeploy-hasura] | |
steps: | |
- name: "Checkout: ${{github.event.pull_request.head.label}}" | |
uses: actions/checkout@v3 | |
with: | |
ref: ${{github.event.pull_request.head.sha}} | |
- name: Set Up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to Registry: ${{needs.env.outputs.DOCKER_REGISTRY}}" | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{needs.env.outputs.DOCKER_REGISTRY}} | |
username: _json_key | |
password: ${{secrets.GCP_SA_KEY}} | |
- name: "Build & Push Container Image: ${{needs.env.outputs.HASURA_TAG}}" | |
uses: docker/build-push-action@v5 | |
with: | |
file: hasura/Dockerfile | |
context: hasura | |
tags: ${{needs.env.outputs.HASURA_TAG}} | |
build-args: | | |
BACKEND_HOST=${{needs.env.outputs.BACKEND_HOST}} | |
BACKEND_PROTOCOL=https | |
push: true | |
deploy-hasura: | |
name: Deploy Hasura | |
runs-on: ubuntu-latest | |
needs: [env, build-hasura, deploy-backend] | |
env: | |
db: ${{needs.env.outputs.DB_NAME}} | |
pass: ${{needs.env.outputs.DB_PASSWORD}} | |
host: ${{needs.env.outputs.DB_HOST}} | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Deploy Container Image: ${{needs.env.outputs.HASURA_TAG}}" | |
run: | | |
gcloud -q run deploy ${{needs.env.outputs.HASURA_SERVICE}} \ | |
--image ${{needs.env.outputs.HASURA_TAG}} \ | |
--region ${{needs.env.outputs.CLOUDRUN_REGION}} \ | |
--port ${{needs.env.outputs.HASURA_PORT}} \ | |
--cpu 1 \ | |
--memory 512Mi \ | |
--ingress all \ | |
--allow-unauthenticated \ | |
--add-cloudsql-instances ${{needs.env.outputs.CLOUDSQL_CONNECTION_NAME}} \ | |
--max-instances 1 \ | |
--set-env-vars REMOTE_SCHEMA_ENDPOINT=${{needs.env.outputs.REMOTE_SCHEMA_ENDPOINT}} \ | |
--set-env-vars HASURA_GRAPHQL_DATABASE_URL=postgres://${{env.db}}:${{env.pass}}@${{env.host}} \ | |
--set-env-vars HASURA_GRAPHQL_ADMIN_SECRET=${{needs.env.outputs.HASURA_SECRET}} \ | |
--set-env-vars HASURA_GRAPHQL_SERVER_PORT=${{needs.env.outputs.HASURA_PORT}} \ | |
--set-env-vars HASURA_GRAPHQL_ENABLE_CONSOLE=true | |
undeploy-frontend: | |
name: Undeploy Frontend | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete Service: ${{needs.env.outputs.FRONTEND_SERVICE}}" | |
continue-on-error: true | |
run: | | |
gcloud -q run services delete ${{needs.env.outputs.FRONTEND_SERVICE}} \ | |
--region ${{needs.env.outputs.CLOUDRUN_REGION}} | |
delete-frontend: | |
name: Delete Frontend Container Image | |
runs-on: ubuntu-latest | |
needs: [env] | |
steps: | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v0.6.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
service_account_key: ${{secrets.GCP_SA_KEY}} | |
export_default_credentials: true | |
- name: "Delete Container Image: ${{needs.env.outputs.FRONTEND_TAG}}" | |
continue-on-error: true | |
run: gcloud -q artifacts docker images delete ${{needs.env.outputs.FRONTEND_TAG}} | |
build-frontend: | |
name: Build Frontend Container Image | |
runs-on: ubuntu-latest | |
needs: [env, delete-frontend, undeploy-frontend, deploy-hasura, seed-db] | |
steps: | |
- name: Set Up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: "Login to Registry: ${{needs.env.outputs.DOCKER_REGISTRY}}" | |
uses: docker/login-action@v3 | |
with: | |
registry: ${{needs.env.outputs.DOCKER_REGISTRY}} | |
username: _json_key | |
password: ${{secrets.GCP_SA_KEY}} | |
- name: "Build & Push Container Image: ${{needs.env.outputs.FRONTEND_TAG}}" | |
uses: docker/build-push-action@v5 | |
with: | |
file: docker/frontend/Dockerfile | |
tags: ${{needs.env.outputs.FRONTEND_TAG}} | |
build-args: | | |
TARGET=${{needs.env.outputs.FRONTEND_TARGET}} | |
APP_ENV=${{needs.env.outputs.APP_ENV}} | |
GRAPHQL_URL=${{needs.env.outputs.GRAPHQL_URL}} | |
FRONTEND_URL=${{needs.env.outputs.FRONTEND_URL}} | |
YOUTUBE_API_KEY=${{secrets.YOUTUBE_API_KEY}} | |
IMGIX_TOKEN=${{secrets.IMGIX_TOKEN}} | |
WEB3_STORAGE_TOKEN=${{secrets.WEB3_STORAGE_TOKEN}} | |
OPENSEA_API_KEY=${{secrets.OPENSEA_API_KEY}} | |
GCAL_PRIVATE_KEY=${{secrets.GCAL_PRIVATE_KEY}} | |
GCAL_PROJECT_NUMBER=${{secrets.GCAL_PROJECT_NUMBER}} | |
GCAL_CLIENT_EMAIL=${{secrets.GCAL_CLIENT_EMAIL}} | |
GCAL_CALENDAR_ID=${{secrets.GCAL_CALENDAR_ID}} | |
WEB3_STORAGE_DID=${{secrets.WEB3_STORAGE_DID}} | |
WEB3_STORAGE_PROOF=${{secrets.WEB3_STORAGE_PROOF}} | |
WEB3_STORAGE_KEY=${{secrets.WEB3_STORAGE_KEY}} | |
ALCHEMY_MAINNET=${{secrets.ALCHEMY_MAINNET}} | |
ALCHEMY_OPTIMISM=${{secrets.ALCHEMY_OPTIMISM}} | |
ALCHEMY_POLYGON=${{secrets.ALCHEMY_POLYGON}} | |
ALCHEMY_API_KEY=${{secrets.ALCHEMY_API_KEY}} | |
WALLET_CONNECT_V2_KEY=${{secrets.WALLET_CONNECT_V2_KEY}} | |
push: true | |
deploy-frontend: | |
name: Deploy Frontend | |
runs-on: ubuntu-latest | |
needs: [env, build-frontend] | |
steps: | |
- name: Authenticate to Google Cloud | |
uses: google-github-actions/auth@v1.1.0 | |
with: | |
project_id: ${{needs.env.outputs.PROJECT_ID}} | |
credentials_json: ${{secrets.GCP_SA_KEY}} | |
create_credentials_file: true | |
- name: Set Up gcloud CLI | |
uses: google-github-actions/setup-gcloud@v1.1.0 | |
- name: "Deploy Container Image: ${{needs.env.outputs.FRONTEND_SERVICE}}" | |
# this is running a shell script of unknown provision that's failing | |
# the deployment, however, isn't | |
continue-on-error: true | |
run: | | |
gcloud -q run deploy ${{needs.env.outputs.FRONTEND_SERVICE}} \ | |
--image ${{needs.env.outputs.FRONTEND_TAG}} \ | |
--region ${{needs.env.outputs.CLOUDRUN_REGION}} \ | |
--port ${{needs.env.outputs.FRONTEND_PORT}} \ | |
--cpu ${{needs.env.outputs.FRONTEND_TARGET == 'development' && '2' || '1'}} \ | |
--memory ${{needs.env.outputs.FRONTEND_TARGET == 'development' && '5Gi' || '1Gi'}} \ | |
--ingress all \ | |
--max-instances 1 \ | |
--allow-unauthenticated \ | |
--set-env-vars GCAL_PRIVATE_KEY="${{secrets.GCAL_PRIVATE_KEY}}" \ | |
--set-env-vars GCAL_PROJECT_NUMBER="${{secrets.GCAL_PROJECT_NUMBER}}" \ | |
--set-env-vars GCAL_CLIENT_EMAIL="${{secrets.GCAL_CLIENT_EMAIL}}" \ | |
--set-env-vars NEXT_PUBLIC_GCAL_CALENDAR_ID="${{secrets.GCAL_CALENDAR_ID}}" \ | |
--set-env-vars OPENSEA_API_KEY="${{secrets.OPENSEA_API_KEY}}" \ | |
--set-env-vars NEXT_PUBLIC_GOOGLE_ANALYTICS_ID="${{secrets.GOOGLE_ANALYTICS_ID}}" \ | |
--set-env-vars NEXT_PUBLIC_YOUTUBE_API_KEY="${{secrets.YOUTUBE_API_KEY}}" \ | |
--set-env-vars NEXT_PUBLIC_WEB3_STORAGE_DID="${{secrets.WEB3_STORAGE_DID}}" \ | |
--set-env-vars NEXT_PUBLIC_WEB3_STORAGE_PROOF="${{secrets.WEB3_STORAGE_PROOF}}" \ | |
--set-env-vars NEXT_PUBLIC_WEB3_STORAGE_KEY="${{secrets.WEB3_STORAGE_KEY}}" \ | |
--set-env-vars NEXT_PUBLIC_ALCHEMY_MAINNET="${{secrets.ALCHEMY_MAINNET}}" \ | |
--set-env-vars NEXT_PUBLIC_ALCHEMY_OPTIMISM="${{secrets.ALCHEMY_OPTIMISM}}" \ | |
--set-env-vars NEXT_PUBLIC_ALCHEMY_POLYGON="${{secrets.ALCHEMY_POLYGON}}" \ | |
--set-env-vars NEXT_PUBLIC_ALCHEMY_API_KEY="${{secrets.ALCHEMY_API_KEY}}" \ | |
--set-env-vars NEXT_PUBLIC_WALLETCONNECT_PROJECT_ID="${{secrets.WALLET_CONNECT_V2_KEY}}" | |
seed-db: | |
name: Seed Database | |
runs-on: ubuntu-latest | |
needs: [env, deploy-hasura] | |
steps: | |
- name: "Checkout: ${{github.event.pull_request.head.label}}" | |
uses: actions/checkout@v2 | |
with: | |
ref: ${{github.event.pull_request.head.sha}} | |
- name: Seed Database | |
continue-on-error: true | |
run: | | |
mv package.json package.json.temp | |
npm install --no-package-lock --no-save node-fetch bottleneck | |
mv package.json.temp package.json | |
SOURCE_GRAPHQL_URL="${{needs.env.outputs.GRAPHQL_URL}}" \ | |
ACCOUNT_SYNC_URL="${{needs.env.outputs.SC_SYNC_URL}}" \ | |
yarn hasura:seed-db | |
finish-deployment: | |
name: Finish Deployment | |
runs-on: ubuntu-latest | |
needs: [env, start-deployment, deploy-frontend] | |
if: always() | |
env: | |
result: ${{needs.deploy-frontend.result}} | |
steps: | |
- name: Finish Deployment | |
uses: bobheadxi/deployments@v1 | |
with: | |
step: finish | |
token: ${{github.token}} | |
env: ${{env.DEPLOYMENT_NAME}} | |
env_url: ${{needs.env.outputs.FRONTEND_URL}} | |
status: ${{env.result == 'skipped' && 'cancelled' || env.result}} | |
deployment_id: ${{needs.start-deployment.outputs.deployment_id}} |