@@ -3,64 +3,51 @@ name: Deploy to GitHub Pages
3
3
on :
4
4
push :
5
5
branches : [ main ]
6
+ workflow_dispatch :
7
+
8
+ permissions :
9
+ contents : read
10
+ pages : write
11
+ id-token : write
12
+
13
+ concurrency :
14
+ group : " pages"
15
+ cancel-in-progress : false
6
16
7
17
jobs :
8
- build-and-deploy :
18
+ build :
9
19
runs-on : ubuntu-latest
10
-
20
+ steps :
21
+ - name : Checkout
22
+ uses : actions/checkout@v4
23
+
24
+ - name : Setup Node
25
+ uses : actions/setup-node@v4
26
+ with :
27
+ node-version : " 18"
28
+ cache : ' npm'
29
+
30
+ - name : Install dependencies
31
+ run : npm ci
32
+
33
+ - name : Build
34
+ run : npm run build
35
+
36
+ - name : Setup Pages
37
+ uses : actions/configure-pages@v4
38
+
39
+ - name : Upload artifact
40
+ uses : actions/upload-pages-artifact@v3
41
+ with :
42
+ path : ' ./dist'
43
+
44
+ deploy :
11
45
environment :
12
46
name : github-pages
13
47
url : ${{ steps.deployment.outputs.page_url }}
14
-
15
- permissions :
16
- contents : read
17
- pages : write
18
- id-token : write
19
-
48
+ runs-on : ubuntu-latest
49
+ needs : build
20
50
steps :
21
- - name : Checkout
22
- uses : actions/checkout@v4
23
-
24
- - name : Setup Node.js
25
- uses : actions/setup-node@v4
26
- with :
27
- node-version : ' 18'
28
- cache : ' npm'
29
-
30
- - name : Install dependencies
31
- run : npm ci
32
-
33
- - name : Build
34
- run : |
35
- NODE_ENV=production npm run build
36
- touch dist/.nojekyll
37
- ls -la dist/
38
- ls -la dist/assets/
39
- cat dist/index.html | grep -E "(script|link)"
40
-
41
- - name : Deploy built files to root for GitHub Pages
42
- run : |
43
- # Remove everything except .git, .github, and dist
44
- find . -maxdepth 1 ! -name '.' ! -name '.git' ! -name '.github' ! -name 'dist' -exec rm -rf {} +
45
-
46
- # Copy built files to root
47
- cp -r dist/* .
48
-
49
- # Commit and push the changes
50
- git config --local user.email "action@github.com"
51
- git config --local user.name "GitHub Action"
52
- git add .
53
- git commit -m "Deploy: Update root with built files [skip ci]" || echo "No changes to commit"
54
- git push || echo "Nothing to push"
55
-
56
- - name : Setup Pages
57
- uses : actions/configure-pages@v4
58
-
59
- - name : Upload artifact
60
- uses : actions/upload-pages-artifact@v3
61
- with :
62
- path : ./dist
63
-
64
- - name : Deploy to GitHub Pages
65
- id : deployment
66
- uses : actions/deploy-pages@v4
51
+ - name : Deploy to GitHub Pages
52
+ id : deployment
53
+ uses : actions/deploy-pages@v4
0 commit comments