Skip to content

Commit a46b828

Browse files
committed
fix & deploy
1 parent 32b2a3f commit a46b828

File tree

3 files changed

+61
-1
lines changed

3 files changed

+61
-1
lines changed

.github/workflows/deploy.yml

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# Deploy to GitHub Pages
2+
name: Deploy to GitHub Pages
3+
4+
on:
5+
push:
6+
branches: [main]
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: false
17+
18+
jobs:
19+
build:
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Checkout
23+
uses: actions/checkout@v4
24+
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
27+
with:
28+
node-version: 20
29+
cache: npm
30+
31+
- name: Install dependencies
32+
run: npm ci
33+
34+
- name: Build
35+
run: npm run build
36+
37+
- name: Setup Pages
38+
uses: actions/configure-pages@v4
39+
40+
- name: Upload artifact
41+
uses: actions/upload-pages-artifact@v3
42+
with:
43+
path: dist
44+
45+
deploy:
46+
environment:
47+
name: github-pages
48+
url: ${{ steps.deployment.outputs.page_url }}
49+
runs-on: ubuntu-latest
50+
needs: build
51+
steps:
52+
- name: Deploy to GitHub Pages
53+
id: deployment
54+
uses: actions/deploy-pages@v4
55+

src/main.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,13 @@ import {
88
setUserInfo,
99
} from "./edit-html"
1010

11+
// Dynamically build redirect URL for both local dev and GitHub Pages
12+
const redirectUrl = `${window.location.origin}${import.meta.env.BASE_URL}`
13+
console.debug("redirectUrl", redirectUrl)
14+
1115
const manager = createOIDCAuthManager({
1216
clientId: "5eeb1a66-0de1-49d8-a230-3ce22f2dff57",
13-
redirectUrl: "http://127.0.0.1:5173/",
17+
redirectUrl,
1418
scope: "user:read project:read",
1519
})
1620

vite.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { defineConfig } from "vite"
22

33
export default defineConfig({
4+
base: "/js-package-oauth-flow-example/",
45
server: {
56
host: "127.0.0.1",
67
port: 5173,

0 commit comments

Comments
 (0)