Skip to content

Add GitHub Pages workflow for UX deployment #1404

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 17 commits into
base: features/ux
Choose a base branch
from

Conversation

akiskips
Copy link
Contributor

🛠️ Description

Added a new GitHub Actions workflow to automatically deploy the UX application to GitHub Pages. This workflow builds and deploys the web application whenever changes are pushed to the pages-action-ux branch or when manually triggered.

Changes

  • Created new workflow file ux-pages.yml for GitHub Pages deployment
  • Set up proper permissions for GitHub Pages deployment
  • Configured workflow to:
    • Install dependencies
    • Build the application
    • Deploy to GitHub Pages environment
  • Added concurrency settings to prevent concurrent deployments
  • updated the vite.config.yml to set the base to /finops-toolkit/ branch
  • updated the router basename configuration for GitHub Pages support
  • Fixed an issue where the background image in the Showcase component wasn't loading properly in the production build. The problem was caused by an incorrect relative path reference to the image asset.

Implementation Details

  • Uses Node.js 20 for the build process
  • Builds from the web directory
  • Uploads the built artifacts from dist
  • Includes debugging step to list build output before deployment

Usage

Prequisite to run the workflow:

  • Workflow yml file (under .github) needs to be merged to the main branch
  • Github actions need to be activated and source set to "Github Actions". Go to settings->Pages
  • Features/ux branch needs to be allowed to deploy at pages. Set from Settings->Environments-> Deployment branches and tags.

The workflow can be triggered by:

  • Pushing to the features/ux branch
  • Manually from the Actions tab in GitHub

The deployed site will be available at the URL provided in the workflow run output.

📷 Screenshots

image

image

📋 Checklist

🔬 How did you test this change?

  • 🤏 Lint tests
  • 🤞 PS -WhatIf / az validate
  • 👍 Manually deployed + verified
  • 💪 Unit tests
  • 🙌 Integration tests
  • 🚨 This is a breaking change.
  • 🤏 The change is less than 20 lines of code.

📑 Did you update docs/changelog.md?

  • ✅ Updated changelog (required for dev PRs)
  • ➡️ Will add log in a future PR (feature branch PRs only)
  • ❎ Log not needed (small/internal change)

📖 Did you update documentation?

  • ✅ Public docs in docs (required for dev)
  • ✅ Internal dev docs in src (required for dev)
  • ➡️ Will add docs in a future PR (feature branch PRs only)
  • ❎ Docs not needed (small/internal change)

@akiskips akiskips added Needs: Review 👀 PR that is ready to be reviewed Tool: Web app Web app to learn about and manage toolkit resources. labels Mar 15, 2025
@akiskips akiskips added this to the 2025-03 - March milestone Mar 15, 2025
@akiskips akiskips self-assigned this Mar 15, 2025
@akiskips akiskips requested a review from aromano2 as a code owner March 15, 2025 16:29
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds a GitHub Pages deployment workflow for the UX application and adjusts configuration settings for correct deployment routing.

  • Introduces a new GitHub Actions workflow file for GitHub Pages deployment
  • Updates Vite and Router configurations to support the GitHub Pages base path
  • Fixes an issue with the relative path for the background image in production

Reviewed Changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

File Description
src/web/vite.config.ts Sets the base path conditionally for production builds
.github/workflows/ux-pages.yml Defines a workflow to build and deploy the UX application to GitHub Pages
src/web/pages/App.tsx Adjusts Router basename configuration for GitHub Pages compatibility
src/web/components/tests/SideBar.test.tsx Adds testing-library/jest-dom import for improved assertions
Comments suppressed due to low confidence (1)

src/web/pages/App.tsx:21

  • There is an inconsistency between the base path in vite.config.ts ('/finops-toolkit/') and the Router basename in App.tsx ('/finops-toolkit'). To ensure consistent routing, consider aligning them (e.g., include the trailing slash in both).
<Router basename={window.location.hostname === 'localhost' ? '/' : '/finops-toolkit'}>

push:
branches: ["features/ux"]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this need anything or is it intentionally blank? If so, maybe leave a comment so people know it's intentional.

on:
# Runs on pushes targeting the default branch
push:
branches: ["features/ux"]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When this goes live, we only want to run it on main. It's fine to keep it on this branch for now, however.

@@ -0,0 +1 @@
{"root":["./pages/App.tsx","./pages/AzureOptimizationEnginePage.tsx","./pages/BicepRegistryModulesPage.tsx","./pages/CostOptimizationWorkbookPage.tsx","./pages/FinOpsHubsPage.tsx","./pages/FinOpsWorkbooksPage.tsx","./pages/GovernanceWorkbookPage.tsx","./pages/HomePage.tsx","./pages/OpenDataPage.tsx","./pages/PowerBIReportsPage.tsx","./pages/PowerShellModulePage.tsx","./pages/ToolsLandingPage.tsx","./pages/main.tsx","./pages/__tests__/App.test.tsx","./pages/__tests__/HomePage.test.tsx","./components/__tests__/SideBar.test.tsx"],"version":"5.7.2"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need to list out every page manually? This seems like it'll break at some point when we forget to add one 😕

Not sure if this is from this PR or another.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Were doing some tests with build and vite preview, I think the TS compiler generated the file for incremental builds.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the compiler always generate it? Should it be in .gitignore?

@@ -0,0 +1 @@
{"root":["./pages/App.tsx","./pages/AzureOptimizationEnginePage.tsx","./pages/BicepRegistryModulesPage.tsx","./pages/CostOptimizationWorkbookPage.tsx","./pages/FinOpsHubsPage.tsx","./pages/FinOpsWorkbooksPage.tsx","./pages/GovernanceWorkbookPage.tsx","./pages/HomePage.tsx","./pages/OpenDataPage.tsx","./pages/PowerBIReportsPage.tsx","./pages/PowerShellModulePage.tsx","./pages/ToolsLandingPage.tsx","./pages/main.tsx","./pages/__tests__/App.test.tsx","./pages/__tests__/HomePage.test.tsx","./components/__tests__/SideBar.test.tsx"],"version":"5.7.2"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does the compiler always generate it? Should it be in .gitignore?

@flanakin
Copy link
Collaborator

@Ivanmtta can you please review?

@flanakin flanakin modified the milestones: 2025-03 - March, Web app Mar 29, 2025
@flanakin flanakin added Status: ▶️ Ready Issue is ready for a dev to start work and removed Needs: Review 👀 PR that is ready to be reviewed labels Apr 15, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: ▶️ Ready Issue is ready for a dev to start work Tool: Web app Web app to learn about and manage toolkit resources.
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

3 participants