@@ -2,30 +2,44 @@ name: Deploy Astro to GitHub Pages
22
33on :
44 push :
5- branches : [ main ] # or your default branch
6- workflow_dispatch : # allow manual runs
5+ branches : [ main ]
6+ workflow_dispatch :
77
88permissions :
9- contents : read # for checkout
10- pages : write # to publish
11- id-token : write # for OIDC
9+ contents : read
10+ pages : write
11+ id-token : write
1212
1313jobs :
1414 build-and-deploy :
1515 runs-on : ubuntu-latest
1616
1717 steps :
18- # 1. Fetch your code
18+ # 1️⃣ Fetch your code
1919 - name : Checkout repository
20- uses : actions/checkout@v4 # :contentReference[oaicite:1]{index=1}
20+ uses : actions/checkout@v4
2121
22- # 2. Build & stage your Astro site
23- - name : Build Astro site
24- uses : withastro/action@v4 # :contentReference[oaicite:2]{index=2}
25- # no 'with' block needed unless your Astro project lives in a subfolder
22+ # 2️⃣ Setup Node.js & build
23+ - name : Setup Node.js
24+ uses : actions/setup-node@v3
25+ with :
26+ node-version : ' 18'
27+ - name : Install dependencies & build
28+ run : |
29+ npm ci
30+ npm run build
2631
27- # 3. Publish to GitHub Pages
32+ # 3️⃣ Configure the Pages environment
33+ - name : Configure Pages
34+ uses : actions/configure-pages@v3
35+
36+ # 4️⃣ Upload the built site as an artifact
37+ - name : Upload Pages artifact
38+ uses : actions/upload-pages-artifact@v1
39+ with :
40+ path : ./dist
41+
42+ # 5️⃣ Deploy to GitHub Pages
2843 - name : Deploy to GitHub Pages
2944 id : deployment
30- uses : actions/deploy-pages@v2 # :contentReference[oaicite:3]{index=3}
31-
45+ uses : actions/deploy-pages@v2
0 commit comments