Skip to content

Commit

Permalink
ci: 增加 github pages
Browse files Browse the repository at this point in the history
  • Loading branch information
wjgogogo committed Oct 29, 2024
1 parent 059a395 commit b5839c4
Show file tree
Hide file tree
Showing 3 changed files with 63 additions and 1 deletion.
60 changes: 60 additions & 0 deletions .github/workflows/deply.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy Rspress site to Pages

on:
push:
branches: [main]

workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: deploy-pages
cancel-in-progress: true

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- uses: pnpm/action-setup@v3
with:
version: 9

- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: 20
cache: pnpm

- name: Setup Pages
uses: actions/configure-pages@v5

- name: Install dependencies
run: pnpm install

- name: Build with Rspress
run: |
pnpm docs:build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: ./packages/rspress-site/doc_build

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: build
runs-on: ubuntu-latest
name: Deploy
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
"description": "",
"scripts": {
"react:dev": "pnpm --filter react-dojo dev",
"docs:dev": "pnpm --filter rspress-docs dev"
"docs:dev": "pnpm --filter rspress-docs dev",
"docs:build": "pnpm --filter rspress-docs build"
},
"keywords": [],
"author": "",
Expand Down
1 change: 1 addition & 0 deletions packages/rspress-site/rspress.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import { pluginPreview } from "@rspress/plugin-preview";
import { pluginPlayground } from "@rspress/plugin-playground";

export default defineConfig({
base: "/dive-react-19/",
root: path.join(__dirname, "docs"),
globalStyles: path.join(__dirname, "theme/style.css"),
title: "Rspress",
Expand Down

0 comments on commit b5839c4

Please sign in to comment.