docs: Add usage examples for Resource class methods #518
Workflow file for this run
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 Docusaurus to GitHub Pages | |
| on: | |
| # Trigger the workflow on pull requests and pushes to specific branches | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| # Allows you to run this workflow manually from the Actions tab | |
| workflow_dispatch: | |
| # Concurrency configuration to manage parallel workflow runs | |
| # | |
| # Group composition: pages-<event_type>-<unique_identifier> | |
| # - event_type: 'pull_request', 'push', or 'workflow_dispatch' | |
| # - unique_identifier: PR number for PRs, branch ref for pushes/manual runs | |
| # | |
| # Examples of group names: | |
| # - PR #123: "pages-pull_request-123" | |
| # - Push to main: "pages-push-refs/heads/main" | |
| # - Manual run on main: "pages-workflow_dispatch-refs/heads/main" | |
| # | |
| # Behavior: | |
| # - PRs: New commits cancel previous runs (cancel-in-progress: true) | |
| # - Main branch: Runs complete without cancellation (cancel-in-progress: false) | |
| # - Manual dispatch: Runs complete without cancellation (cancel-in-progress: false) | |
| concurrency: | |
| group: pages-${{ github.event_name }}-${{ github.event_name == 'pull_request' && github.event.pull_request.number || github.ref }} | |
| cancel-in-progress: ${{ github.event_name == 'pull_request' }} | |
| jobs: | |
| build: | |
| name: Build Docusaurus | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: '22' | |
| cache: 'npm' | |
| cache-dependency-path: 'package-lock.json' | |
| - name: Install dependencies | |
| run: | | |
| echo "Installing dependencies from $(pwd)" | |
| npm ci || (echo "npm ci failed, uploading logs" && exit 1) | |
| - name: Build Docusaurus site | |
| env: | |
| DOCUSAURUS_ROUTE_BASE_PATH: ${{ vars.DOCUSAURUS_ROUTE_BASE_PATH }} | |
| DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }} | |
| DOCUSAURUS_URL: ${{ vars.DOCUSAURUS_URL }} | |
| ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} | |
| ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }} | |
| ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }} | |
| GA4_TRACKING_ID: ${{ secrets.GA4_TRACKING_ID }} | |
| run: | | |
| echo "Building Docusaurus site..." | |
| echo "Using DOCUSAURUS_ROUTE_BASE_PATH: $DOCUSAURUS_ROUTE_BASE_PATH" | |
| echo "Using DOCUSAURUS_BASE_URL: $DOCUSAURUS_BASE_URL" | |
| echo "Using DOCUSAURUS_URL: $DOCUSAURUS_URL" | |
| npm run build || (echo "Site build failed" && exit 1) | |
| - name: Upload npm logs on failure | |
| if: failure() | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: npm-logs | |
| path: | | |
| ~/.npm/_logs/ | |
| - name: Upload Build Artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: build | |
| deploy: | |
| needs: build | |
| name: Deploy to GitHub Pages | |
| runs-on: ubuntu-latest | |
| # Only deploy on push to main or manual trigger, not on PRs | |
| if: (github.event_name == 'push' && github.ref == 'refs/heads/main') || github.event_name == 'workflow_dispatch' | |
| permissions: | |
| pages: write | |
| id-token: write | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |