Skip to content

Deploy Minifront

Deploy Minifront #501

name: Deploy Minifront
on:
schedule:
- cron: '0 */6 * * *' # Runs at every 6th hour (4x a day)
workflow_call:
workflow_dispatch:
push:
branches:
- '*'
jobs:
build_and_deploy:
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}
CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
CLOUDFLARE_PROJECT_NAME: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}
FIREBASE_PROJECT_ID: ${{ secrets.FIREBASE_PROJECT_ID }}
runs-on: ubuntu-latest
steps:
# 🛠️ ========== Needed to build minifront ========== 🛠️
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup pnpm
uses: pnpm/action-setup@v4
with:
version: 9
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: wasm32-unknown-unknown
- name: Setup wasm-pack
uses: jetli/[email protected]
with:
version: 'latest'
- name: Clone Penumbra Web repo
run: git clone https://github.com/penumbra-zone/web
- name: Install dependencies
run: pnpm install
working-directory: ./web
env:
NODE_OPTIONS: --max-old-space-size=4096 # Increase Node.js heap size given memory-intensive steps
- name: Disable Turbo Telemetry
run: pnpm turbo telemetry disable
working-directory: ./web
- name: Build Minifront
run: pnpm turbo run build --filter=./apps/minifront --concurrency=1
working-directory: ./web
env:
NODE_OPTIONS: --max-old-space-size=4096 # Increase Node.js heap size
# 🛠️ =========================================================== 🛠️
# Pick your hosting providers below.
# Enable a provider by getting the required secrets and putting them into
# your repository secrets under the corresponding names.
# You can enable as many providers as you like - they will all be deployed sequentially
# ┌· · · · · · · · · · · · · · · · · · · · · · · · ·┐
# · Vercel ·
# └· · · · · · · · · · · · · · · · · · · · · · · · ·┘
# Create a new project in your Vercel console (choose this forked repo as the connected repo)
#
# Needed env variables:
# VERCEL_ORG_ID: Get from https://vercel.com/<TEAM NAME>/~/settings#team-id (it's called team id in the UI)
# VERCEL_PROJECT_ID: Get from https://vercel.com/<TEAM NAME>/<PROJECT NAME>/settings
# VERCEL_TOKEN: Create one here https://vercel.com/account/tokens
#
- name: Install Vercel CLI
if: ${{ env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' && env.VERCEL_TOKEN != '' }}
run: pnpm add --global vercel@latest
- name: Pull Vercel Environment Information
if: ${{ env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' && env.VERCEL_TOKEN != '' }}
run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ./web/apps/minifront/dist/
- name: Build Project Artifacts
if: ${{ env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' && env.VERCEL_TOKEN != '' }}
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ./web/apps/minifront/dist/
- name: Deploy Project Artifacts to Vercel
if: ${{ env.VERCEL_ORG_ID != '' && env.VERCEL_PROJECT_ID != '' && env.VERCEL_TOKEN != '' }}
run: vercel deploy --prebuilt --prod --yes --token=${{ secrets.VERCEL_TOKEN }}
working-directory: ./web/apps/minifront/dist/
# ┌· · · · · · · · · · · · · · · · · · · · · · · · ·┐
# · Netlify ·
# └· · · · · · · · · · · · · · · · · · · · · · · · ·┘
# Create a new site in your Netlify dashboard
#
# Needed env variables:
# NETLIFY_AUTH_TOKEN: https://docs.netlify.com/cli/get-started/#obtain-a-token-in-the-netlify-ui
# NETLIFY_SITE_ID: In your site -> Site configuration -> Site ID
#
- name: Install Netlify CLI
if: ${{ env.NETLIFY_AUTH_TOKEN != '' && env.NETLIFY_SITE_ID != '' }}
run: npm install netlify-cli -g
- name: Deploy to Netlify
if: ${{ env.NETLIFY_AUTH_TOKEN != '' && env.NETLIFY_SITE_ID != '' }}
run: |
netlify deploy --dir=./web/apps/minifront/dist --prod
# ┌· · · · · · · · · · · · · · · · · · · · · · · · ·┐
# · Couldflare pages ·
# └· · · · · · · · · · · · · · · · · · · · · · · · ·┘
# Create a new site in your Netlify dashboard
#
# Needed env variables:
# CLOUDFLARE_API_TOKEN: https://dash.cloudflare.com/profile/api-tokens
# CLOUDFLARE_PROJECT_NAME: Name of your site
# CLOUDFLARE_ACCOUNT_ID: Select a site and copy Account ID from the right sidebar
# GITHUB_TOKEN is filled in automatically
#
- name: Deploy to Cloudflare Pages
uses: cloudflare/pages-action@v1
if: ${{ env.CLOUDFLARE_API_TOKEN != '' && env.CLOUDFLARE_ACCOUNT_ID != '' && env.CLOUDFLARE_PROJECT_NAME != '' }}
with:
apiToken: ${{ secrets.CLOUDFLARE_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: ${{ secrets.CLOUDFLARE_PROJECT_NAME }}
directory: ./web/apps/minifront/dist
gitHubToken: ${{ secrets.GITHUB_TOKEN }}
# ┌· · · · · · · · · · · · · · · · · · · · · · · · ·┐
# · Surge.sh ·
# └· · · · · · · · · · · · · · · · · · · · · · · · ·┘
# Needed env variables:
# SURGE_LOGIN: your surge email address
# SURGE_TOKEN: run `surge token` in your terminal
#
- name: Install Surge
if: ${{ env.SURGE_LOGIN != '' && env.SURGE_TOKEN != '' }}
run: npm install -g surge
- name: Deploy to Surge
if: ${{ env.SURGE_LOGIN != '' && env.SURGE_TOKEN != '' }}
env:
SURGE_LOGIN: ${{ secrets.SURGE_LOGIN }}
SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }}
run: surge --project ./web/apps/minifront/dist
# ┌· · · · · · · · · · · · · · · · · · · · · · · · ·┐
# · Firebase hosting ·
# └· · · · · · · · · · · · · · · · · · · · · · · · ·┘
# Create a new project in your Firebase Console
#
# Needed env variables:
# FIREBASE_PROJECT_ID: can be seen in your projects overview, usually a dash-separated version of your project name
# FIREBASE_TOKEN: npm i -g firebase-tools && firebase login:ci
#
- name: Setup Firebase CLI
if: ${{ env.FIREBASE_TOKEN != '' && env.FIREBASE_PROJECT_ID != '' }}
run: npm install -g firebase-tools
- name: Deploy to Firebase
if: ${{ env.FIREBASE_TOKEN != '' && env.FIREBASE_PROJECT_ID != '' }}
run: |
firebase deploy --only hosting --project ${{ secrets.FIREBASE_PROJECT_ID }} --token ${{ secrets.FIREBASE_TOKEN }} --public ./web/apps/minifront/dist
# ┌· · · · · · · · · · · · · · · · · · · · · · · · ·┐
# · Github Pages .
# └· · · · · · · · · · · · · · · · · · · · · · · · ·┘
# This step will copy the minifront build to a gh-pages branch.
# To deploy, enable Github Pages in your repository settings,
# and follow the deployments link on your repository page.
- name: Deploy to GitHub Actions
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: ./web/apps/minifront/dist