Skip to content

Commit 589b9e2

Browse files
committed
Update astro.yml
1 parent a1c669a commit 589b9e2

File tree

1 file changed

+8
-47
lines changed

1 file changed

+8
-47
lines changed

.github/workflows/astro.yml

Lines changed: 8 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,21 @@
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 Pages
1+
name: Deploy Astro site to Pages with pnpm
62

73
on:
8-
# Runs on pushes targeting the default branch
94
push:
105
branches: ["main"]
11-
12-
# Allows you to run this workflow manually from the Actions tab
136
workflow_dispatch:
147

15-
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
168
permissions:
179
contents: read
1810
pages: write
1911
id-token: write
2012

21-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
22-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
2313
concurrency:
2414
group: "pages"
2515
cancel-in-progress: false
2616

2717
env:
28-
BUILD_PATH: "." # default value when not using subfolders
29-
# BUILD_PATH: subfolder
18+
BUILD_PATH: "."
3019

3120
jobs:
3221
build:
@@ -36,55 +25,27 @@ jobs:
3625
- name: Checkout
3726
uses: actions/checkout@v4
3827

39-
- name: Detect package manager
40-
id: detect-package-manager
41-
run: |
42-
if [ -f "${{ github.workspace }}/pnpm-lock.yaml" ]; then
43-
echo "manager=pnpm" >> $GITHUB_OUTPUT
44-
echo "command=install" >> $GITHUB_OUTPUT
45-
echo "runner=pnpm" >> $GITHUB_OUTPUT
46-
echo "lockfile=pnpm-lock.yaml" >> $GITHUB_OUTPUT
47-
exit 0
48-
elif [ -f "${{ github.workspace }}/yarn.lock" ]; then
49-
echo "manager=yarn" >> $GITHUB_OUTPUT
50-
echo "command=install" >> $GITHUB_OUTPUT
51-
echo "runner=yarn" >> $GITHUB_OUTPUT
52-
echo "lockfile=yarn.lock" >> $GITHUB_OUTPUT
53-
exit 0
54-
elif [ -f "${{ github.workspace }}/package.json" ]; then
55-
echo "manager=npm" >> $GITHUB_OUTPUT
56-
echo "command=ci" >> $GITHUB_OUTPUT
57-
echo "runner=npx --no-install" >> $GITHUB_OUTPUT
58-
echo "lockfile=package-lock.json" >> $GITHUB_OUTPUT
59-
exit 0
60-
else
61-
echo "Unable to determine package manager"
62-
exit 1
63-
fi
64-
6528
- name: Enable pnpm
6629
run: corepack enable
67-
30+
6831
- name: Setup Node
6932
uses: actions/setup-node@v4
7033
with:
7134
node-version: "20"
72-
cache: ${{ steps.detect-package-manager.outputs.manager }}
73-
cache-dependency-path: ${{ env.BUILD_PATH }}/${{ steps.detect-package-manager.outputs.lockfile }}
74-
35+
cache: "pnpm"
36+
cache-dependency-path: ${{ env.BUILD_PATH }}/pnpm-lock.yaml
7537

76-
7738
- name: Setup Pages
7839
id: pages
7940
uses: actions/configure-pages@v5
8041

81-
- name: Install dependencies
82-
run: ${{ steps.detect-package-manager.outputs.manager }} ${{ steps.detect-package-manager.outputs.command }}
42+
- name: Install dependencies with pnpm
43+
run: pnpm install
8344
working-directory: ${{ env.BUILD_PATH }}
8445

8546
- name: Build with Astro
8647
run: |
87-
${{ steps.detect-package-manager.outputs.runner }} astro build \
48+
pnpm astro build \
8849
--site "${{ steps.pages.outputs.origin }}" \
8950
--base "${{ steps.pages.outputs.base_path }}"
9051
working-directory: ${{ env.BUILD_PATH }}

0 commit comments

Comments
 (0)