Skip to content

Commit ba74d5d

Browse files
authored
Update GitHub Actions workflow for Astro deployment
1 parent 08c109f commit ba74d5d

File tree

1 file changed

+31
-20
lines changed

1 file changed

+31
-20
lines changed

.github/workflows/deploy.yml

Lines changed: 31 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
11
name: Deploy to GitHub Pages
22

33
on:
4-
# Trigger the workflow every time you push to the `main` branch
5-
# Using a different branch name? Replace `main` with your branch’s name
64
push:
75
branches: [ main ]
8-
# Allows you to run this workflow manually from the Actions tab on GitHub.
96
workflow_dispatch:
107

11-
# Allow this job to clone the repo and create a page deployment
128
permissions:
139
contents: read
1410
pages: write
@@ -18,27 +14,42 @@ jobs:
1814
build:
1915
runs-on: ubuntu-latest
2016
steps:
21-
- name: Checkout your repository using git
17+
- name: Checkout repository
2218
uses: actions/checkout@v5
23-
- name: Install, build, and upload your site
24-
uses: withastro/action@v5
25-
with:
26-
# path: . # The root location of your Astro project inside the repository. (optional)
27-
# node-version: 24 # The specific version of Node that should be used to build your site. Defaults to 22. (optional)
28-
package-manager: npm
29-
working-directory: project # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
30-
# build-cmd: pnpm run build
31-
# The command to run to build your site. Runs the package build script/task by default. (optional)
32-
# env:
33-
# PUBLIC_POKEAPI: 'https://pokeapi.co/api/v2' # Use single quotation marks for the variable value. (optional)
19+
20+
- name: Set up Node.js
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: 20 # or whichever Node version you want
24+
25+
- name: Install dependencies
26+
run: |
27+
cd project
28+
npm ci
29+
30+
- name: Build Astro site
31+
run: |
32+
cd project
33+
npm run build
34+
35+
- name: Upload build artifacts
36+
uses: actions/upload-artifact@v3
37+
with:
38+
name: astro-build
39+
path: project/dist # default Astro build output
3440

3541
deploy:
3642
needs: build
3743
runs-on: ubuntu-latest
38-
environment:
39-
name: github-pages
40-
url: ${{ steps.deployment.outputs.page_url }}
4144
steps:
45+
- name: Download build artifacts
46+
uses: actions/download-artifact@v3
47+
with:
48+
name: astro-build
49+
path: dist
50+
4251
- name: Deploy to GitHub Pages
43-
id: deployment
4452
uses: actions/deploy-pages@v4
53+
id: deployment
54+
with:
55+
folder: dist

0 commit comments

Comments
 (0)