Skip to content

Commit 22ad6f3

Browse files
committed
update workflow
1 parent bfc76f5 commit 22ad6f3

File tree

1 file changed

+32
-24
lines changed

1 file changed

+32
-24
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 32 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -13,48 +13,56 @@ permissions:
1313
pages: write
1414
id-token: write
1515

16-
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
17-
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
16+
# Allow one concurrent deployment
1817
concurrency:
19-
group: "pages"
20-
cancel-in-progress: false
18+
group: 'pages'
19+
cancel-in-progress: true
2120

2221
jobs:
23-
# Build job
24-
build:
22+
cache-and-install:
2523
runs-on: ubuntu-latest
24+
environment:
25+
name: github-pages
26+
url: ${{ steps.deployment.outputs.page_url }}
2627
steps:
2728
- name: Checkout
2829
uses: actions/checkout@v4
2930

30-
- name: Setup Node.js
31+
- name: Install Node.js
3132
uses: actions/setup-node@v4
3233
with:
33-
node-version: '18'
34-
cache: 'npm'
34+
node-version: 22
3535

36-
- name: Install dependencies
37-
run: npm ci
36+
- uses: pnpm/action-setup@v4
37+
name: Install pnpm
38+
with:
39+
version: 9
40+
run_install: false
3841

39-
- name: Build
40-
run: npm run build
42+
- name: Get pnpm store directory
43+
shell: bash
44+
run: |
45+
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
46+
47+
- uses: actions/cache@v4
48+
name: Setup pnpm cache
49+
with:
50+
path: ${{ env.STORE_PATH }}
51+
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
52+
restore-keys: |
53+
${{ runner.os }}-pnpm-store-
4154
55+
- name: Install dependencies
56+
run: pnpm install
57+
- name: Build
58+
run: pnpm run build
4259
- name: Setup Pages
4360
uses: actions/configure-pages@v4
44-
4561
- name: Upload artifact
4662
uses: actions/upload-pages-artifact@v3
4763
with:
64+
# Upload dist folder
4865
path: './dist'
49-
50-
# Deployment job
51-
deploy:
52-
environment:
53-
name: github-pages
54-
url: ${{ steps.deployment.outputs.page_url }}
55-
runs-on: ubuntu-latest
56-
needs: build
57-
steps:
5866
- name: Deploy to GitHub Pages
5967
id: deployment
60-
uses: actions/deploy-pages@v4
68+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)