Skip to content

Commit a0fa40c

Browse files
committed
Update GitHub Pages deploy flow for Astro site
1 parent cabc961 commit a0fa40c

1 file changed

Lines changed: 16 additions & 19 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# Workflow to build and deploy a SvelteKit website to GitHub Pages
2-
name: Deploy static SvelteKit content to Pages
1+
# Workflow to build and deploy an Astro website to GitHub Pages
2+
name: Deploy Astro site to Pages
33

44
on:
55
# Runs on pushes targeting the default branch
@@ -28,27 +28,24 @@ jobs:
2828
- name: Checkout
2929
uses: actions/checkout@v4
3030

31-
- name: Install Node.js
32-
uses: actions/setup-node@v3
33-
with:
34-
node-version: latest
35-
cache: npm
36-
37-
- name: Install dependencies
38-
run: npm i
39-
4031
- name: Setup Pages
4132
uses: actions/configure-pages@v4
4233
with:
43-
static_site_generator: "sveltekit"
44-
45-
- name: Build site
46-
run: npm run build
47-
48-
- name: Upload artifact
49-
uses: actions/upload-pages-artifact@v3
34+
static_site_generator: astro
35+
36+
- name: Set base path for project pages
37+
shell: bash
38+
run: |
39+
if [[ "${{ github.repository }}" == "${{ github.repository_owner }}.github.io" ]]; then
40+
echo "BASE_PATH=/" >> "$GITHUB_ENV"
41+
else
42+
echo "BASE_PATH=/${{ github.event.repository.name }}" >> "$GITHUB_ENV"
43+
fi
44+
45+
- name: Build Astro site and prepare Pages artifact
46+
uses: withastro/action@v4
5047
with:
51-
path: "build/"
48+
package-manager: npm
5249

5350
deploy:
5451
needs: build-site

0 commit comments

Comments
 (0)