docs: add GitHub Pages setup guide and enable workflow on feature branch #1
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Deploy VitePress Docs | |
| on: | |
| push: | |
| branches: [main, feature/docs-site] | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/deploy-docs.yml' | |
| workflow_dispatch: # Allow manual triggers | |
| # Sets permissions for GitHub Pages deployment | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| # Prevent concurrent deployments | |
| concurrency: | |
| group: pages | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 # For lastUpdated feature | |
| - name: Retrieve Node.js version | |
| id: node-version | |
| run: echo "node-version=$(grep '^nodejs ' .tool-versions | awk '{print $2}')" >> $GITHUB_OUTPUT | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: ${{ steps.node-version.outputs.node-version }} | |
| cache: 'npm' | |
| cache-dependency-path: docs/package-lock.json | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| - name: Install dependencies | |
| working-directory: docs | |
| run: npm ci | |
| - name: Build with VitePress | |
| working-directory: docs | |
| run: npm run build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: docs/.vitepress/dist | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| needs: build | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |