diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..954dfae --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,64 @@ +name: Deploy VitePress Site +on: + push: + branches: [main] + pull_request: + branches: [main] + workflow_dispatch: + +env: + TZ: Asia/Shanghai + +permissions: + contents: read + pages: write + id-token: write + +concurrency: + group: pages + cancel-in-progress: false + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + node-version: [20] + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: ${{ matrix.node-version }} + + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: latest + run_install: false + + - name: Install dependencies + run: pnpm install + + - name: Build VitePress site + run: pnpm docs:build + + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + with: + path: .vitepress/dist + + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4