File tree Expand file tree Collapse file tree 1 file changed +36
-38
lines changed
Expand file tree Collapse file tree 1 file changed +36
-38
lines changed Original file line number Diff line number Diff line change 1- # Simple workflow for deploying static content to GitHub Pages
2- name : Deploy static content to Pages
1+ name : Deploy
32
43on :
5- # Runs on pushes targeting the default branch
64 push :
7- branches : ['main']
8-
9- # Allows you to run this workflow manually from the Actions tab
10- workflow_dispatch :
11-
12- # Sets the GITHUB_TOKEN permissions to allow deployment to GitHub Pages
13- permissions :
14- contents : read
15- pages : write
16- id-token : write
17-
18- # Allow one concurrent deployment
19- concurrency :
20- group : ' pages'
21- cancel-in-progress : true
5+ branches :
6+ - main
227
238jobs :
24- # Single deploy job since we're just deploying
25- deploy :
26- environment :
27- name : github-pages
28- url : ${{ steps.deployment.outputs.page_url }}
9+ build :
10+ name : Build
2911 runs-on : ubuntu-latest
12+
3013 steps :
31- - name : Checkout
14+ - name : Checkout repo
3215 uses : actions/checkout@v3
33- - name : Set up Node
16+
17+ - name : Setup Node
3418 uses : actions/setup-node@v3
35- with :
36- node-version : 18
37- cache : ' npm'
19+
3820 - name : Install dependencies
39- run : npm install
40- - name : Build
21+ uses : bahmutov/npm-install@v1
22+
23+ - name : Build project
4124 run : npm run build
42- - name : Setup Pages
43- uses : actions/configure-pages@v3
44- - name : Upload artifact
45- uses : actions/upload-pages-artifact@v3
25+
26+ - name : Upload production-ready build files
27+ uses : actions/upload-artifact@v3
4628 with :
47- # Upload dist repository
48- path : ' ./dist'
29+ name : production-files
30+ path : ./dist
31+
32+ deploy :
33+ name : Deploy
34+ needs : build
35+ runs-on : ubuntu-latest
36+ if : github.ref == 'refs/heads/main'
37+
38+ steps :
39+ - name : Download artifact
40+ uses : actions/download-artifact@v3
41+ with :
42+ name : production-files
43+ path : ./dist
44+
4945 - name : Deploy to GitHub Pages
50- id : deployment
51- uses : actions/deploy-pages@v1
46+ uses : peaceiris/actions-gh-pages@v3
47+ with :
48+ github_token : ${{ secrets.GITHUB_TOKEN }}
49+ publish_dir : ./dist
You can’t perform that action at this time.
0 commit comments