Skip to content

Commit d3a8f7a

Browse files
authored
Refactor GitHub Actions for documentation deployment
1 parent ff7f0df commit d3a8f7a

1 file changed

Lines changed: 20 additions & 35 deletions

File tree

.github/workflows/deploy-docs.yml

Lines changed: 20 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,29 @@
1-
# https://github.com/actions/deploy-pages#usage
2-
name: Deploy to GitHub Pages
1+
name: Deploy Docs
2+
33
on:
4-
workflow_dispatch:
54
push:
6-
branches:
7-
- main
5+
86
jobs:
9-
build:
7+
deploy:
108
runs-on: ubuntu-latest
11-
defaults:
12-
run:
13-
working-directory: docs
149
steps:
1510
- uses: actions/checkout@v4
16-
- run: corepack enable
11+
- uses: pnpm/action-setup@v4
1712
- uses: actions/setup-node@v4
1813
with:
19-
node-version: "24"
20-
# Pick your own package manager and build script
21-
- run: npm install
22-
- run: npx nuxi generate
23-
- name: Upload artifact
24-
uses: actions/upload-pages-artifact@v3
14+
node-version: lts/*
15+
cache: pnpm
16+
17+
- name: Install dependencies
18+
run: pnpm install
19+
20+
- run: pnpm build
21+
22+
- run: pnpm docs:build
23+
24+
- name: Deploy
25+
uses: peaceiris/actions-gh-pages@v4
2526
with:
26-
path: ./docs/dist
27-
# Deployment job
28-
deploy:
29-
# Add a dependency to the build job
30-
needs: build
31-
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
32-
permissions:
33-
pages: write # to deploy to Pages
34-
id-token: write # to verify the deployment originates from an appropriate source
35-
# Deploy to the github_pages environment
36-
environment:
37-
name: github-pages
38-
url: ${{ steps.deployment.outputs.page_url }}
39-
# Specify runner + deployment step
40-
runs-on: ubuntu-latest
41-
steps:
42-
- name: Deploy to GitHub Pages
43-
id: deployment
44-
uses: actions/deploy-pages@v4
27+
github_token: ${{ secrets.GITHUB_TOKEN }}
28+
publish_dir: docs/.vitepress/dist
29+
# cname: example.com # if wanna deploy to custom domain

0 commit comments

Comments
 (0)