website: update vitepress ci

This commit is contained in:
weishu
2023-11-13 11:58:59 +08:00
parent aa21385a36
commit 5da1767ff8

View File

@@ -10,29 +10,54 @@ on:
- 'website/**' - 'website/**'
workflow_dispatch: workflow_dispatch:
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued.
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete.
concurrency:
group: pages
cancel-in-progress: false
jobs: jobs:
deploy: # Build job
build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
defaults:
run:
working-directory: ./website
steps: steps:
- uses: actions/checkout@v4 - name: Checkout
uses: actions/checkout@v3
with: with:
fetch-depth: 0 fetch-depth: 0 # Not needed if lastUpdated is not enabled
- uses: actions/setup-node@v3 - name: Setup Node
uses: actions/setup-node@v3
with: with:
node-version: 16 node-version: 18
cache: yarn cache: yarn # or pnpm / yarn
cache-dependency-path: website/yarn.lock - name: Setup Pages
- run: yarn install --frozen-lockfile uses: actions/configure-pages@v3
- name: Install dependencies
run: yarn install # or pnpm install / yarn install / bun install
- name: Build with VitePress
run: |
yarn docs:build
touch docs/.vitepress/dist/.nojekyll
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: docs/.vitepress/dist
- name: Build # Deployment job
run: yarn docs:build deploy:
environment:
- name: Deploy name: github-pages
uses: peaceiris/actions-gh-pages@v3 url: ${{ steps.deployment.outputs.page_url }}
with: needs: build
github_token: ${{ secrets.GITHUB_TOKEN }} runs-on: ubuntu-latest
publish_dir: website/docs/.vitepress/dist name: Deploy
cname: kernelsu.org # if wanna deploy to custom domain steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2