Skip to content
This repository has been archived by the owner on Jan 20, 2025. It is now read-only.

feat: 工作流

feat: 工作流 #22

name: pages-build-site
on:
push:
branches:
- main
jobs:
deploy:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Node.js
uses: actions/setup-node@v3
with:
node-version: 20
- uses: pnpm/action-setup@v2
name: Install pnpm
id: pnpm-install
with:
version: 9
run_install: false
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ steps.pnpm-cache.outputs.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: Install dependencies
run: pnpm install
- name: Build docs
run: pnpm run build
- name: Create and push to new branch
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
run: |
# 设置 Git 用户信息
git config --global user.name "Manshawar"
git config --global user.email "[email protected]"
git checkout --orphan doc_build
git rm -rf .
mv doc_build/* .
rm -rf doc_build
git add .
git commit -m "Generated documentation"
git push origin doc_build --force