Skip to content

Commit 1661773

Browse files
committed
chore: use official github pages workflow
1 parent 2833099 commit 1661773

1 file changed

Lines changed: 42 additions & 37 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 42 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,57 @@
1-
name: deploy github pages
1+
name: Deploy GitHub Pages
2+
23
on:
34
push:
45
branches:
56
- main
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: pages
16+
cancel-in-progress: true
617

718
jobs:
8-
Build:
19+
build:
920
runs-on: ubuntu-latest
21+
1022
steps:
11-
- name: checkout code
12-
uses: actions/checkout@v3
13-
- name: actions/setup-node@v3
14-
uses: actions/setup-node@v3
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
26+
- name: Configure GitHub Pages
27+
uses: actions/configure-pages@v5
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v6
1531
with:
16-
node-version: '16.14'
32+
node-version: 22
1733
cache: yarn
18-
cache-dependency-path: '**/yarn.lock'
19-
- name: yarn cache
20-
id: yarn-cache-dir-path
21-
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
22-
- uses: actions/cache@v3
23-
id: yarn-cache
24-
with:
25-
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
26-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
27-
restore-keys: |
28-
${{ runner.os }}-yarn-
29-
- run: yarn install --frozen-lockfile && yarn build
30-
- name: upload dist
31-
uses: actions/upload-artifact@v3
34+
cache-dependency-path: yarn.lock
35+
36+
- name: Install dependencies
37+
run: yarn install --frozen-lockfile
38+
39+
- name: Build site
40+
run: yarn build
41+
42+
- name: Upload Pages artifact
43+
uses: actions/upload-pages-artifact@v5
3244
with:
33-
name: build-pages
3445
path: dist
35-
retention-days: 1
3646

37-
Deploy:
38-
needs: Build
47+
deploy:
48+
needs: build
3949
runs-on: ubuntu-latest
50+
environment:
51+
name: github-pages
52+
url: ${{ steps.deployment.outputs.page_url }}
53+
4054
steps:
41-
- name: checkout code
42-
uses: actions/checkout@v3
43-
- name: download build files
44-
uses: actions/download-artifact@v3
45-
with:
46-
name: build-pages
47-
path: dist
48-
- name: deploy
49-
uses: JamesIves/github-pages-deploy-action@v4.4.1
50-
with:
51-
branch: gh-pages
52-
folder: dist
55+
- name: Deploy to GitHub Pages
56+
id: deployment
57+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)