@@ -2,30 +2,55 @@ name: Deploy to GitHub Pages
22
33on :
44 push :
5- branches :
6- - main
5+ branches : [ "main" ]
6+
7+ # Allows you to run this workflow manually from the Actions tab
8+ workflow_dispatch :
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
721
822jobs :
9- build-and-deploy :
23+ build :
1024 runs-on : ubuntu-latest
1125
1226 steps :
13- - name : Checkout code
14- uses : actions/checkout@v3
27+ - name : Checkout source
28+ uses : actions/checkout@v4
29+
30+ - name : Setup Node.js
31+ uses : actions/setup-node@v4
32+ with :
33+ node-version : ' 18' # Use your desired Node version
1534
16- - name : Install Node.js
17- uses : actions/setup-node@v3
18- with :
19- node-version : 20
35+ - name : Install dependencies
36+ run : npm install
2037
21- - name : Install dependencies
22- run : npm install
38+ - name : Build project
39+ run : npm run build
2340
24- - name : Build project
25- run : npm run build # Ensure your `package.json` has a `build` script
41+ - name : Upload artifact
42+ uses : actions/upload-pages-artifact@v3
43+ with :
44+ path : ./dist
2645
27- - name : Deploy to GitHub Pages
28- uses : peaceiris/actions-gh-pages@v3
29- with :
30- github_token : ${{ secrets.GITHUB_TOKEN }}
31- publish_dir : ./dist
46+ deploy :
47+ needs : build
48+ runs-on : ubuntu-latest
49+ environment :
50+ name : github-pages
51+ url : ${{ steps.deployment.outputs.page_url }}
52+
53+ steps :
54+ - name : Deploy to GitHub Pages
55+ id : deployment
56+ uses : actions/deploy-pages@v4
0 commit comments