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
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 55 additions & 0 deletions .github/workflows/ux-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Deploy UX to GitHub Pages
on:
# TODO: Restore the push trigger after prod. Runs on pushes targeting the default branch
#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.


# Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write


# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
# Single deploy job since we're just deploying
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'npm'
- name: Install dependencies
run: npm ci
working-directory: ./src/web
- name: Clean and Build
run: |
rm -rf ./dist || true
NODE_ENV=production npm run build
working-directory: ./src/web
- name: Setup Pages
uses: actions/configure-pages@v4
- name: List build output
run: ls -la ./src/web/dist
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
# Upload dist folder
path: './src/web/dist'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 1 addition & 0 deletions src/web/components/__tests__/SideBar.test.tsx
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import '@testing-library/jest-dom';
import { render, screen, fireEvent } from '@testing-library/react';
import { BrowserRouter } from 'react-router-dom';
import SideBar from '../SideBar/SideBar';
Expand Down
2 changes: 1 addition & 1 deletion src/web/pages/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ import {HomePage} from '../pages/HomePage';
function App() {
return (
<FluentUIProvider>
<Router>
<Router basename={window.location.hostname === 'localhost' ? '/' : '/finops-toolkit'}>
<Routes>
<Route path="/" element={<HomePage />} />
<Route path="/bicep-registry" element={<BicepRegistryModulesPage />} />
Expand Down
1 change: 1 addition & 0 deletions src/web/tsconfig.app.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -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?

1 change: 1 addition & 0 deletions src/web/tsconfig.node.tsbuildinfo
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"root":["./vite.config.ts"],"version":"5.7.2"}
3 changes: 2 additions & 1 deletion src/web/vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
plugins: [react()],
plugins: [react()],
base: process.env.NODE_ENV === 'production' ? '/finops-toolkit/' : '/'
})