Skip to content

Commit c5def9f

Browse files
authored
Merge pull request #3 from mag1cfrog/dev/astro-migration
Refactor GitHub Actions workflow: enhance comments and structure for …
2 parents b6008cd + 5b80a44 commit c5def9f

1 file changed

Lines changed: 28 additions & 14 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 28 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,30 +2,44 @@ name: Deploy Astro to GitHub Pages
22

33
on:
44
push:
5-
branches: [ main ] # or your default branch
6-
workflow_dispatch: # allow manual runs
5+
branches: [ main ]
6+
workflow_dispatch:
77

88
permissions:
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

1313
jobs:
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

Comments
 (0)