Skip to content

Commit 2d8b835

Browse files
authored
Merge pull request #11 from jonaspm/dev
fix/fix build with astro
2 parents 186e56e + 2ccaacb commit 2d8b835

File tree

1 file changed

+17
-69
lines changed

1 file changed

+17
-69
lines changed

.github/workflows/astro.yml

Lines changed: 17 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -1,91 +1,39 @@
1-
# Sample workflow for building and deploying an Astro site to GitHub Pages
2-
#
3-
# To get started with Astro see: https://docs.astro.build/en/getting-started/
4-
#
5-
name: Deploy Astro site to GitHub Pages
1+
name: Deploy to GitHub Pages
62

73
on:
8-
# Runs on pushes targeting the default branch
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
96
push:
10-
branches:
11-
- main
12-
13-
# Allows you to run this workflow manually from the Actions tab
7+
branches: [ main ]
8+
# Allows you to run this workflow manually from the Actions tab on GitHub.
149
workflow_dispatch:
1510

16-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
11+
# Allow this job to clone the repo and create a page deployment
1712
permissions:
1813
contents: read
1914
pages: write
2015
id-token: write
2116

22-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
23-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
24-
concurrency:
25-
group: "pages"
26-
cancel-in-progress: false
27-
28-
env:
29-
BUILD_PATH: "." # default value when not using subfolders
30-
# BUILD_PATH: subfolder
31-
3217
jobs:
3318
build:
34-
name: Build
3519
runs-on: ubuntu-latest
3620
steps:
37-
- name: Checkout
21+
- name: Checkout your repository using git
3822
uses: actions/checkout@v3
39-
with:
40-
ref: main
41-
- name: Detect package manager
42-
id: detect-package-manager
43-
run: |
44-
if [ -f "${{ github.workspace }}/yarn.lock" ]; then
45-
echo "manager=yarn" >> $GITHUB_OUTPUT
46-
echo "command=install" >> $GITHUB_OUTPUT
47-
echo "runner=yarn" >> $GITHUB_OUTPUT
48-
exit 0
49-
elif [ -f "${{ github.workspace }}/package.json" ]; then
50-
echo "manager=npm" >> $GITHUB_OUTPUT
51-
echo "command=ci" >> $GITHUB_OUTPUT
52-
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
53-
exit 0
54-
else
55-
echo "Unable to determine package manager"
56-
exit 1
57-
fi
58-
- name: Setup Node
59-
uses: actions/setup-node@v4
60-
with:
61-
node-version: "10"
62-
cache: ${{ steps.detect-package-manager.outputs.manager }}
63-
cache-dependency-path: ${{ env.BUILD_PATH }}/package-lock.json
64-
- name: Setup Pages
65-
id: pages
66-
uses: actions/configure-pages@v4
67-
- name: Install dependencies
68-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
69-
working-directory: ${{ env.BUILD_PATH }}
70-
- name: Build with Astro
71-
run: |
72-
${{ steps.detect-package-manager.outputs.runner }} astro build \
73-
--site "${{ steps.pages.outputs.origin }}" \
74-
--base "${{ steps.pages.outputs.base_path }}"
75-
working-directory: ${{ env.BUILD_PATH }}
76-
- name: Upload artifact
77-
uses: actions/upload-pages-artifact@v1
78-
with:
79-
path: ${{ env.BUILD_PATH }}/dist
23+
- name: Install, build, and upload your site
24+
uses: withastro/action@v1
25+
# with:
26+
# path: . # The root location of your Astro project inside the repository. (optional)
27+
# node-version: 18 # The specific version of Node that should be used to build your site. Defaults to 18. (optional)
28+
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
8029

8130
deploy:
82-
environment:
83-
name: main
84-
url: ${{ steps.deployment.outputs.page_url }}
8531
needs: build
8632
runs-on: ubuntu-latest
87-
name: Deploy
33+
environment:
34+
name: github-pages
35+
url: ${{ steps.deployment.outputs.page_url }}
8836
steps:
8937
- name: Deploy to GitHub Pages
9038
id: deployment
91-
uses: actions/deploy-pages@v3
39+
uses: actions/deploy-pages@v1

0 commit comments

Comments
 (0)