Skip to content

Commit

Permalink
feat: Deploy the Explorer in production mode
Browse files Browse the repository at this point in the history
  • Loading branch information
alainncls committed Jan 4, 2024
1 parent f9f12a1 commit 2907e3b
Show file tree
Hide file tree
Showing 10 changed files with 243 additions and 14 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/explorer-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build explorer

on:
pull_request:
branches:
- main
- dev
- release/*
push:
branches:
- main
- dev
- release/*

jobs:
build-explorer:
runs-on: ubuntu-latest

defaults:
run:
working-directory: explorer

steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Build
run: pnpm run build

- name: Add build summary
run: |
echo "## Explorer build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
67 changes: 67 additions & 0 deletions .github/workflows/explorer-deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
name: Deploy explorer

on:
workflow_dispatch:

jobs:
deploy-explorer-prod:
runs-on: ubuntu-latest

defaults:
run:
working-directory: explorer

steps:
- name: Check out the repo
uses: actions/checkout@v4

- name: Install Pnpm
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install --frozen-lockfile

- name: Add env file
if: steps.check-changes.outputs.changed == 'true'
run: |
touch explorer/.env
echo "VITE_WALLETCONNECT_PROJECT_ID=${{ secrets.VITE_WALLETCONNECT_PROJECT_ID }}" >> explorer/.env
echo "VITE_INFURA_API_KEY=${{ secrets.VITE_INFURA_API_KEY }}" >> explorer/.env
- name: Build
run: pnpm run build

- name: Deploy explorer to Netlify
uses: netlify/actions/cli@master
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
with:
args: deploy --dir=dist --prod

- name: Add explorer deployment summary
run: |
echo "## Explorer production deployment result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
102 changes: 102 additions & 0 deletions .github/workflows/explorer-deploy-staging.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,102 @@
name: Deploy explorer

on:
pull_request:
branches:
- dev
push:
branches:
- dev

jobs:
deploy-explorer-staging:
runs-on: ubuntu-latest

defaults:
run:
working-directory: explorer

steps:
- name: Check out the repo
uses: actions/checkout@v4
with:
fetch-depth: 0

- id: check-changes
run: |
if [ -n "$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.event.pull_request.head.sha }} | grep '^explorer/')" ]; then
echo "::set-output name=changed::true"
else
echo "::set-output name=changed::false"
fi
- name: Install Pnpm
if: steps.check-changes.outputs.changed == 'true'
uses: pnpm/action-setup@v2
with:
version: 8
run_install: false

- name: Install Node.js
if: steps.check-changes.outputs.changed == 'true'
uses: actions/setup-node@v3
with:
node-version: 18
cache: pnpm

- name: Get pnpm store directory
if: steps.check-changes.outputs.changed == 'true'
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
if: steps.check-changes.outputs.changed == 'true'
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
if: steps.check-changes.outputs.changed == 'true'
run: pnpm install --frozen-lockfile

- name: Add env file
if: steps.check-changes.outputs.changed == 'true'
run: |
touch explorer/.env
echo "VITE_WALLETCONNECT_PROJECT_ID=${{ secrets.VITE_WALLETCONNECT_PROJECT_ID }}" >> explorer/.env
echo "VITE_INFURA_API_KEY=${{ secrets.VITE_INFURA_API_KEY }}" >> explorer/.env
- name: Build
if: steps.check-changes.outputs.changed == 'true'
run: pnpm run build

- name: Deploy to Netlify
if: steps.check-changes.outputs.changed == 'true'
uses: nwtgck/actions-netlify@v2.0
with:
publish-dir: "./explorer/dist"
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: "Deploy from GitHub Actions"
enable-pull-request-comment: false
enable-commit-comment: true
overwrites-pull-request-comment: true
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID_STAGING }}
timeout-minutes: 1

- name: Add explorer deployment summary
if: steps.check-changes.outputs.changed == 'true'
run: |
echo "## Explorer staging deployment result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
- name: Add explorer deployment summary
if: steps.check-changes.outputs.changed == 'false'
run: |
echo "## Explorer staging deployment result" >> $GITHUB_STEP_SUMMARY
echo "✅ No change detected in the explorer" >> $GITHUB_STEP_SUMMARY
1 change: 0 additions & 1 deletion .github/workflows/releaser.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
---
name: New version releaser

on:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- release/*

jobs:
test:
test-sdk:
runs-on: ubuntu-latest

defaults:
Expand Down
14 changes: 7 additions & 7 deletions .github/workflows/smart-contracts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ env:
FOUNDRY_PROFILE: ci

jobs:
build:
build-contracts:
runs-on: ubuntu-latest

defaults:
Expand All @@ -43,7 +43,7 @@ jobs:
echo "## Build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
test-unit:
test-contracts:
runs-on: ubuntu-latest

defaults:
Expand All @@ -53,7 +53,7 @@ jobs:
env:
FOUNDRY_FUZZ_RUNS: 1000

needs: build
needs: build-contracts

steps:
- name: Check out the repo
Expand All @@ -72,10 +72,10 @@ jobs:
echo "## Unit tests result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
coverage:
coverage-contracts:
runs-on: ubuntu-latest

needs: build
needs: build-contracts

steps:
- name: Check out the repo
Expand Down Expand Up @@ -111,14 +111,14 @@ jobs:
echo "## Coverage result" >> $GITHUB_STEP_SUMMARY
echo "✅ Uploaded to Codecov" >> $GITHUB_STEP_SUMMARY
upgradeability:
upgradeability-contracts:
runs-on: ubuntu-latest

defaults:
run:
working-directory: contracts

needs: build
needs: build-contracts

steps:
- name: Check out the repo
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/subgraph.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- release/*

jobs:
test:
test-subgraph:
runs-on: ubuntu-latest

defaults:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/website-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ on:
- release/*

jobs:
website-build:
build-website:
runs-on: ubuntu-latest

defaults:
Expand Down Expand Up @@ -57,5 +57,5 @@ jobs:

- name: Add build summary
run: |
echo "## Website built result" >> $GITHUB_STEP_SUMMARY
echo "## Website build result" >> $GITHUB_STEP_SUMMARY
echo "✅ Passed" >> $GITHUB_STEP_SUMMARY
2 changes: 1 addition & 1 deletion .github/workflows/website-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ concurrency:
cancel-in-progress: true

jobs:
website-deploy:
deploy-website:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
Expand Down
2 changes: 1 addition & 1 deletion explorer/README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Verax Attestation Registry - Explorer

This package manages the explorer of Verax Attestation Registry, soon to be released.
This package manages the explorer of Verax Attestation Registry, hosted at [explorer.ver.ax](https://explorer.ver.ax).

## Getting Started

Expand Down

0 comments on commit 2907e3b

Please sign in to comment.