Skip to content

Releases/mainnet/token dashboard/v1.21.0 #222

Releases/mainnet/token dashboard/v1.21.0

Releases/mainnet/token dashboard/v1.21.0 #222

name: Token Dashboard / Mainnet
on:
pull_request:
branches: [main]
paths:
- solidity-v1/dashboard/**
# For pull_request_target:
# - Checkout with repository set to PR repo, ref same (see
# https://github.com/actions/checkout#usage).
# - Trigger from issue comment?
jobs:
build-docker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Build Docker Build Image
uses: docker/build-push-action@v2
with:
cache-from: type=local,src=/tmp/.buildx-cache
cache-to: type=local,dest=/tmp/.buildx-cache-new
- # Temp fix - move cache instead of copying (added below step and
# modified value of `cache-to`).
# https://github.com/docker/build-push-action/issues/252
# https://github.com/moby/buildkit/issues/1896
# Without the change some jobs were failing with `no space left on device`
name: Move cache
run: |
rm -rf /tmp/.buildx-cache
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
build-and-deploy:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [12.11.x]
if: startsWith(github.head_ref, 'releases/mainnet/token-dashboard/')
defaults:
run:
working-directory: solidity-v1/dashboard
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
# This step forces Git to download dependencies using `https://` protocol,
# even if `package-lock.json` refers to some package via `git://`. Using
# `git://` is no longer supported by GH. One of the `dashboard`
# dependencies by default uses `git://` and we needed to manually remove
# it every time it re-appeared in the lock file. Now even if it does,
# the `npm ci` will not fail.
- name: Configure git to don't use unauthenticated protocol
run: git config --global url."https://".insteadOf git://
- run: npm ci
#- run: npm run lint
#- if: github.event_name == 'push' TODO uncomment when mainnet builds happen this way
# run: npm run build --if-present
- if: github.event_name == 'pull_request'
run: npm run build
env:
PUBLIC_URL: /${{ github.head_ref }}
# A push event is a main merge; deploy to primary bucket.
# TODO uncomment when mainnet builds happen this way
#- if: github.event_name == 'push'
# name: Deploy Main to GCP
# uses: thesis/[email protected]
# with:
# service-key: ${{ secrets.KEEP_DASHBOARD_UPLOADER_SERVICE_KEY_JSON }}
# project: keep-prd-210b
# bucket-name: dashboard.keep.network
# build-folder: solidity-v1/dashboard/build
# A pull_request event is a PR; deploy to preview bucket.
- if: github.event_name == 'pull_request'
name: Deploy PR preview to GCP
uses: thesis/[email protected]
with:
service-key: ${{ secrets.KEEP_DASHBOARD_UPLOADER_SERVICE_KEY_JSON_BASE64 }}
project: keep-prd-210b
bucket-name: preview.dashboard.keep.network
bucket-path: ${{ github.head_ref }}
build-folder: solidity-v1/dashboard/build
# A pull_request event is a PR; leave a comment with the preview URL.
- if: github.event_name == 'pull_request'
name: Post preview URL to PR
uses: actions/github-script@v5
with:
script: |
github.rest.issues.createComment({
issue_number: context.issue.number,
owner: context.repo.owner,
repo: context.repo.repo,
body: 'Preview uploaded to https://preview.dashboard.keep.network/${{ github.head_ref }}/.'
})