11# GitHub Actions workflow for apon.js
22# This workflow runs tests and deploys the demo page to GitHub Pages.
33
4- name : Deploy Demo to GitHub Pages
4+ name : Build, Test and Deploy
55
66on :
77 # Runs on pushes targeting the default branch
@@ -25,7 +25,8 @@ concurrency:
2525
2626jobs :
2727 # Build and test job
28- build-and-test :
28+ build :
29+ name : Build and Test
2930 runs-on : ubuntu-latest
3031 steps :
3132 - name : Checkout code
@@ -36,33 +37,25 @@ jobs:
3637 node-version : 20
3738 cache : ' npm'
3839 - name : Install dependencies
39- run : npm install
40+ run : npm ci
4041 - name : Run tests
4142 run : npm test
43+ - name : Prepare for deployment
44+ run : mkdir -p docs/lib && cp lib/apon.js docs/lib/apon.js
45+ - name : Upload artifact for deployment
46+ uses : actions/upload-pages-artifact@v3
47+ with :
48+ path : ' ./docs'
4249
4350 # Deployment job
4451 deploy :
45- needs : build-and-test # This job runs only if the build-and-test job succeeds
52+ name : Deploy to GitHub Pages
53+ needs : build # This job runs only if the build job succeeds
4654 environment :
4755 name : github-pages
4856 url : ${{ steps.deployment.outputs.page_url }}
4957 runs-on : ubuntu-latest
5058 steps :
51- - name : Checkout code
52- uses : actions/checkout@v4
53- - name : Run tests
54- run : npm test
55-
56- - name : Copy lib to docs
57- run : mkdir -p docs/lib && cp lib/apon.js docs/lib/apon.js
58-
59- - name : Setup Pages
60- uses : actions/configure-pages@v4
61- - name : Upload artifact
62- uses : actions/upload-pages-artifact@v3
63- with :
64- # Upload the /docs directory
65- path : ' ./docs'
6659 - name : Deploy to GitHub Pages
6760 id : deployment
68- uses : actions/deploy-pages@v4
61+ uses : actions/deploy-pages@v4
0 commit comments