Skip to content

Commit

Permalink
feat(wallet-dashboard): Improve release process (#4537)
Browse files Browse the repository at this point in the history
* feat(dashboard): Embed git rev into settings panel

* refactor(wallet-dashboard): Update CI

* typo

* fix: Add missing isStaging: false to preview deploys of the explorer

* fmt

* also embed the rev in the welcome page
  • Loading branch information
marc2332 authored Dec 18, 2024
1 parent 00429a8 commit 455641d
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 17 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/_vercel_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,14 +68,16 @@ jobs:
secrets: inherit
with:
isProd: false
isStaging: false

wallet-dashboard-prod:
name: Vercel Wallet Dashboard Production
wallet-dashboard-staging:
name: Vercel Wallet Dashboard Staging
if: github.ref_name == 'develop'
uses: ./.github/workflows/apps_wallet_dashboard_deploy.yml
secrets: inherit
with:
isProd: true
isProd: false
isStaging: true

apps-backend-preview:
name: Vercel apps-backend Preview
Expand Down
16 changes: 15 additions & 1 deletion .github/workflows/apps_wallet_dashboard_deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,25 @@ name: Deploy for Wallet Dashboard
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
VERCEL_PROJECT_ID: ${{ secrets.WALLET_DASHBOARD_VERCEL_PROJECT_ID }}
WALLET_DASHBOARD_VERCEL_PROJECT_STAGING_URL: ${{ secrets.WALLET_DASHBOARD_VERCEL_PROJECT_STAGING_URL }}

on:
workflow_dispatch:
inputs:
isProd:
type: boolean
required: true
isStaging:
type: boolean
required: true
workflow_call:
inputs:
isProd:
type: boolean
required: true
isStaging:
type: boolean
required: true

jobs:
deploy:
Expand Down Expand Up @@ -64,8 +75,11 @@ jobs:
id: deploy_url
if: ${{ inputs.isProd == false }}
run: echo "DEPLOY_URL=$(cat vercel_output.txt | awk 'END{print}')" >> $GITHUB_OUTPUT
- name: Alias Staging deploy
if: ${{ inputs.isStaging }}
run: vercel alias ${{ steps.deploy_url.outputs.DEPLOY_URL }} $WALLET_DASHBOARD_VERCEL_PROJECT_STAGING_URL --token=${{ secrets.VERCEL_TOKEN }} --scope=${{ secrets.VERCEL_SCOPE }}
- name: Comment on pull request
if: ${{ inputs.isProd == false }}
if: ${{ inputs.isProd == false && inputs.isStaging == false }}
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
Expand Down
4 changes: 3 additions & 1 deletion apps/wallet-dashboard/app/page.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,10 @@ function HomeDashboardPage(): JSX.Element {
<ConnectButton connectText="Connect" />
</div>
</div>
<div className="text-body-lg text-neutral-60">
<div className="text-center text-body-lg text-neutral-60">
&copy; IOTA Foundation {CURRENT_YEAR}
<br />
{process.env.NEXT_PUBLIC_DASHBOARD_REV}
</div>
</div>
</>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,18 +41,21 @@ export function SettingsListView({ handleClose, setView }: SettingsListViewProps
<DialogLayout>
<Header title="Settings" onClose={handleClose} onBack={handleClose} titleCentered />
<DialogLayoutBody>
<div className="flex w-full flex-col gap-md">
{MENU_ITEMS.map((item, index) => (
<Card key={index} type={CardType.Default} onClick={item.onClick}>
<CardImage type={ImageType.BgSolid}>
<div className="flex h-10 w-10 items-center justify-center rounded-full text-neutral-10 dark:text-neutral-92 [&_svg]:h-5 [&_svg]:w-5">
<span className="text-2xl">{item.icon}</span>
</div>
</CardImage>
<CardBody title={item.title} subtitle={item.subtitle} />
<CardAction type={CardActionType.Link} />
</Card>
))}
<div className="flex h-full flex-col content-stretch">
<div className="flex h-full w-full flex-col gap-md">
{MENU_ITEMS.map((item, index) => (
<Card key={index} type={CardType.Default} onClick={item.onClick}>
<CardImage type={ImageType.BgSolid}>
<div className="flex h-10 w-10 items-center justify-center rounded-full text-neutral-10 dark:text-neutral-92 [&_svg]:h-5 [&_svg]:w-5">
<span className="text-2xl">{item.icon}</span>
</div>
</CardImage>
<CardBody title={item.title} subtitle={item.subtitle} />
<CardAction type={CardActionType.Link} />
</Card>
))}
</div>
<p className="text-center">{process.env.NEXT_PUBLIC_DASHBOARD_REV}</p>
</div>
</DialogLayoutBody>
</DialogLayout>
Expand Down
6 changes: 6 additions & 0 deletions apps/wallet-dashboard/next.config.mjs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
// Copyright (c) 2024 IOTA Stiftung
// SPDX-License-Identifier: Apache-2.0

import { execSync } from 'child_process';
const NEXT_PUBLIC_DASHBOARD_REV = execSync('git rev-parse HEAD').toString().trim().toString();

/** @type {import('next').NextConfig} */
const nextConfig = {
async redirects() {
Expand All @@ -16,6 +19,9 @@ const nextConfig = {
// Remove this domain when fetching data
domains: ['d315pvdvxi2gex.cloudfront.net'],
},
env: {
NEXT_PUBLIC_DASHBOARD_REV,
},
};

export default nextConfig;

0 comments on commit 455641d

Please sign in to comment.