Skip to content

Commit cc92ad2

Browse files
committed
fix: align GitHub Pages workflow with proven deploy pattern
- Add workflow_dispatch for manual triggers - Add caching for node_modules and dist - Use .env for dynamic base URL from GITHUB_REPOSITORY - Set cancel-in-progress: false for production deploys Made-with: Cursor
1 parent f3fe7b3 commit cc92ad2

2 files changed

Lines changed: 38 additions & 16 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 37 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
1-
name: Deploy to GitHub Pages
1+
name: Deploy ThunderX docs to Pages
22

33
on:
44
push:
5-
branches: [main]
5+
branches: ["main"]
6+
67
workflow_dispatch:
78

89
permissions:
@@ -11,33 +12,54 @@ permissions:
1112
id-token: write
1213

1314
concurrency:
14-
group: pages
15-
cancel-in-progress: true
15+
group: "pages"
16+
cancel-in-progress: false
1617

1718
jobs:
1819
build:
1920
runs-on: ubuntu-latest
2021
steps:
21-
- uses: actions/checkout@v4
22+
- name: Checkout
23+
uses: actions/checkout@v4
2224

23-
- uses: actions/setup-node@v4
25+
- name: Setup Node
26+
uses: actions/setup-node@v4
2427
with:
25-
node-version: 20
26-
cache: npm
28+
node-version: "20"
29+
30+
- name: Create .env
31+
run: |
32+
echo "VITE_APP_BASE_URL=/$(echo $GITHUB_REPOSITORY | cut -d '/' -f 2-)/" >> .env
33+
cat .env
34+
35+
- name: Restore cache
36+
uses: actions/cache@v4
37+
with:
38+
path: |
39+
node_modules
40+
dist
41+
key: ${{ runner.os }}-thunderx-build-${{ hashFiles('dist') }}
42+
restore-keys: |
43+
${{ runner.os }}-thunderx-build-
44+
45+
- name: Install dependencies
46+
run: npm i
2747

28-
- run: npm ci
29-
- run: npm run build
48+
- name: Build
49+
run: npm run build
3050

31-
- uses: actions/upload-pages-artifact@v3
51+
- name: Upload artifact
52+
uses: actions/upload-pages-artifact@v3
3253
with:
33-
path: dist
54+
path: ./dist
3455

3556
deploy:
36-
needs: build
37-
runs-on: ubuntu-latest
3857
environment:
3958
name: github-pages
4059
url: ${{ steps.deployment.outputs.page_url }}
60+
runs-on: ubuntu-latest
61+
needs: build
4162
steps:
42-
- id: deployment
63+
- name: Deploy to GitHub Pages
64+
id: deployment
4365
uses: actions/deploy-pages@v4

vite.config.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { defineConfig } from 'vite';
22

33
export default defineConfig({
4-
base: '/web-components/',
4+
base: process.env.VITE_APP_BASE_URL || '/web-components/',
55
build: {
66
outDir: 'dist',
77
},

0 commit comments

Comments
 (0)