From e7d2eee5bbc7bb53cc6775e1d892d140c2108467 Mon Sep 17 00:00:00 2001 From: wighawag Date: Fri, 24 Nov 2023 07:59:13 +0000 Subject: [PATCH] use vitepress github page action --- .github/workflows/docs.yml | 66 +++++++++++++++++++++++++++----------- 1 file changed, 48 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml index f55f827..e997633 100644 --- a/.github/workflows/docs.yml +++ b/.github/workflows/docs.yml @@ -1,20 +1,37 @@ -name: Generate Documentation - -permissions: - contents: write +# Sample workflow for building and deploying a VitePress site to GitHub Pages +# +name: Deploy VitePress site to Pages on: + # Runs on pushes targeting the `main` branch. Change this to `master` if you're + # using the `master` branch as the default branch. push: - branches: ["main"] - pull_request: - branches: ["main"] + branches: [main] + + # Allows you to run this workflow manually from the Actions tab + 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: - generate_docs: + # Build job + build: runs-on: ubuntu-latest steps: - - name: Checkout the repository + - name: Checkout uses: actions/checkout@v3 + with: + fetch-depth: 0 # Not needed if lastUpdated is not enabled - name: Setup pnpm uses: pnpm/action-setup@v2 @@ -25,22 +42,35 @@ jobs: uses: actions/setup-node@v3 with: node-version: ${{ matrix.node-version }} - cache: "pnpm" + cache: 'pnpm' - name: Install dependencies run: pnpm install - - name: Build all packages + - name: Build all run: pnpm build - - name: Generate Documentation - run: pnpm gen-docs + - name: Build with VitePress + run: pnpm run docs:build + - name: Copy demo in docs - run: cp -R examples/web-demo/dist docs/examples + run: cp -R examples/web-demo/dist docs/.vitepress/dist/examples - - name: Deploy 🚀 - uses: JamesIves/github-pages-deploy-action@4.1.4 + - name: Upload artifact + uses: actions/upload-pages-artifact@v2 with: - branch: gh-pages - folder: docs + path: docs/.vitepress/dist + + # Deployment job + 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@v2