Skip to content

Commit 6b8dd2c

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

1 file changed

Lines changed: 16 additions & 7 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 16 additions & 7 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
@@ -29,26 +29,35 @@ jobs:
2929
uses: actions/checkout@v4
3030

3131
- name: Install Node.js
32-
uses: actions/setup-node@v3
32+
uses: actions/setup-node@v4
3333
with:
34-
node-version: latest
34+
node-version: 20
3535
cache: npm
3636

3737
- name: Install dependencies
38-
run: npm i
38+
run: npm ci
3939

4040
- name: Setup Pages
4141
uses: actions/configure-pages@v4
4242
with:
43-
static_site_generator: "sveltekit"
43+
static_site_generator: astro
44+
45+
- name: Set base path for project pages
46+
shell: bash
47+
run: |
48+
if [[ "${{ github.repository }}" == "${{ github.repository_owner }}.github.io" ]]; then
49+
echo "BASE_PATH=/" >> "$GITHUB_ENV"
50+
else
51+
echo "BASE_PATH=/${{ github.event.repository.name }}" >> "$GITHUB_ENV"
52+
fi
4453
4554
- name: Build site
4655
run: npm run build
4756

4857
- name: Upload artifact
4958
uses: actions/upload-pages-artifact@v3
5059
with:
51-
path: "build/"
60+
path: "dist/"
5261

5362
deploy:
5463
needs: build-site

0 commit comments

Comments
 (0)