1- # Sample workflow for building and deploying an Astro site to GitHub Pages
2- #
3- # To get started with Astro see: https://docs.astro.build/en/getting-started/
4- #
5- name : Deploy Astro site to Pages
1+ name : Deploy to GitHub Pages
62
73on :
8- # Runs on pushes targeting the default branch
94 push :
10- branches : ["master"]
11-
12- # Allows you to run this workflow manually from the Actions tab
5+ branches : [master]
6+ # Allows you to run this workflow manually from the Actions tab on GitHub.
137 workflow_dispatch :
148
15- # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
9+ # Allow this job to clone the repo and create a page deployment
1610permissions :
1711 contents : read
1812 pages : write
1913 id-token : write
2014
21- # Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22- # However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
23- concurrency :
24- group : " pages"
25- cancel-in-progress : false
26-
27- env :
28- BUILD_PATH : " www"
29- # BUILD_PATH: subfolder
30-
3115jobs :
3216 build :
33- name : Build
3417 runs-on : ubuntu-latest
3518 steps :
36- - name : Checkout
19+ - name : Checkout your repository using git
3720 uses : actions/checkout@v4
38- - name : Detect package manager
39- id : detect-package-manager
40- run : |
41- if [ -f "${{ github.workspace }}/yarn.lock" ]; then
42- echo "manager=yarn" >> $GITHUB_OUTPUT
43- echo "command=install" >> $GITHUB_OUTPUT
44- echo "runner=yarn" >> $GITHUB_OUTPUT
45- echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
46- exit 0
47- elif [ -f "${{ github.workspace }}/package.json" ]; then
48- echo "manager=npm" >> $GITHUB_OUTPUT
49- echo "command=ci" >> $GITHUB_OUTPUT
50- echo "runner=npx --no-install" >> $GITHUB_OUTPUT
51- echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT
52- exit 0
53- else
54- echo "Unable to determine package manager"
55- exit 1
56- fi
57- - name : Setup Node
58- uses : actions/setup-node@v4
21+ - name : Install Node.js
22+ uses : actions/setup-node@v3
5923 with :
60- node-version : " 20"
61- cache : ${{ steps.detect-package-manager.outputs.manager }}
62- cache-dependency-path : ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }}
63- - name : Setup Pages
64- id : pages
65- uses : actions/configure-pages@v5
24+ node-version : 20
25+ cache : ' pnpm'
6626 - name : Install dependencies
67- run : ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
68- working-directory : ${{ env.BUILD_PATH }}
69- - name : Build with Astro
70- run : |
71- npm run build
72- npm run docs:copy
73- ${{ steps.detect-package-manager.outputs.runner }} astro build \
74- --site "${{ steps.pages.outputs.origin }}" \
75- --base "${{ steps.pages.outputs.base_path }}"
76- working-directory : ${{ env.BUILD_PATH }}
27+ run : npm ci
28+ - name : Run site build
29+ run : npm run docs
7730 - name : Upload artifact
7831 uses : actions/upload-pages-artifact@v3
7932 with :
80- path : ${{ env.BUILD_PATH }} /dist
33+ path : ./www /dist
8134
8235 deploy :
36+ needs : build
37+
38+ permissions :
39+ pages : write # to deploy to Pages
40+ id-token : write # to verify the deployment originates from an appropriate source
41+
8342 environment :
8443 name : github-pages
8544 url : ${{ steps.deployment.outputs.page_url }}
86- needs : build
45+
8746 runs-on : ubuntu-latest
88- name : Deploy
8947 steps :
9048 - name : Deploy to GitHub Pages
9149 id : deployment
92- uses : actions/deploy-pages@v4
50+ uses : actions/deploy-pages@v4
0 commit comments