docs: test github action #13
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 Documentation | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| pull_request: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| concurrency: | |
| group: "pages" | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout docs branch | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: docs | |
| - name: Checkout main branch docs content | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: main | |
| path: main-repo | |
| sparse-checkout: | | |
| docs | |
| sparse-checkout-cone-mode: false | |
| - name: Copy main branch docs to content directory | |
| run: | | |
| if [ -d "main-repo/docs" ]; then | |
| rm -rf apps/docs/content | |
| cp -r main-repo/docs/ apps/docs/content | |
| echo "Copied docs from main branch" | |
| else | |
| echo "No docs directory found in main branch, using existing content" | |
| fi | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'yarn' | |
| cache-dependency-path: yarn.lock | |
| - name: Install dependencies | |
| run: | | |
| yarn install | |
| - name: Build Docusaurus site | |
| run: | | |
| yarn run build | |
| - name: Setup Pages | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/configure-pages@v4 | |
| - name: Upload artifact | |
| if: github.ref == 'refs/heads/main' | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: apps/docs/build | |
| deploy: | |
| if: github.ref == 'refs/heads/main' | |
| 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 |