Skip to content

Commit f5e7bc4

Browse files
task: Deploy UI in GH Pages (#4)
* add gh pages Signed-off-by: Carlos Feria <[email protected]> * add slash characters for gh base url Signed-off-by: Carlos Feria <[email protected]> --------- Signed-off-by: Carlos Feria <[email protected]>
1 parent a3a4217 commit f5e7bc4

File tree

4 files changed

+49
-2
lines changed

4 files changed

+49
-2
lines changed

.github/workflows/deploy.yaml

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
name: Deploy to GH Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
workflow_call:
9+
10+
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
permissions:
12+
contents: read
13+
pages: write
14+
id-token: write
15+
16+
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17+
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
18+
concurrency:
19+
group: "pages"
20+
cancel-in-progress: false
21+
22+
jobs:
23+
gh-pages:
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
27+
runs-on: ubuntu-latest
28+
steps:
29+
- uses: actions/checkout@v4
30+
- uses: actions/setup-node@v4
31+
with:
32+
node-version: 22
33+
cache: npm
34+
- name: Install dependencies
35+
run: npm ci
36+
- name: Build
37+
run: NODE_ENV=development BASE_URL=/rhtas-console-ui/ npm run build
38+
- name: Setup Pages
39+
uses: actions/configure-pages@v5
40+
- name: Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: "./client/dist"
44+
- name: Deploy to GitHub Pages
45+
id: deployment
46+
uses: actions/deploy-pages@v4

client/src/app/App.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import "@patternfly/patternfly/patternfly-addons.css";
1010

1111
const App: React.FC = () => {
1212
return (
13-
<Router>
13+
<Router basename={import.meta.env.BASE_URL}>
1414
<DefaultLayout>
1515
<AppRoutes />
1616
</DefaultLayout>

client/vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ const faviconPath = path.resolve(brandingPath, "favicon.ico");
1919

2020
// https://vite.dev/config/
2121
export default defineConfig({
22+
base: process.env.BASE_URL,
2223
plugins: [
2324
react(),
2425
{

common/rollup.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ const stringModule = ejs.render(
2323
export default strings;
2424
`,
2525
{
26-
brandingRoot: "branding",
26+
brandingRoot: process.env.BASE_URL ? `${process.env.BASE_URL}/branding` : "branding",
2727
}
2828
);
2929

0 commit comments

Comments
 (0)