Deploy to GitHub Pages #21
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 to GitHub Pages | |
| on: | |
| # Run after the test workflow completes on main branch | |
| workflow_run: | |
| workflows: ['CI'] | |
| branches: [main] | |
| types: [completed] | |
| # Allow manual deployments | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| pages: write | |
| id-token: write | |
| actions: read | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: false | |
| jobs: | |
| build: | |
| # Only run if the test workflow succeeded or this is a manual run | |
| if: ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }} | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Ruby | |
| uses: ruby/setup-ruby@v1 | |
| with: | |
| ruby-version: '.ruby-version' | |
| bundler-cache: true | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Enable pnpm cache | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20' | |
| cache: 'pnpm' | |
| cache-dependency-path: 'docs/pnpm-lock.yaml' | |
| - name: Install docs dependencies | |
| run: | | |
| cd docs && pnpm install --frozen-lockfile | |
| - name: Setup Pages | |
| uses: actions/configure-pages@v4 | |
| with: | |
| static_docs_generator: next | |
| - name: Download coverage artifacts | |
| uses: dawidd6/action-download-artifact@v3 # cspell:ignore dawidd6 | |
| with: | |
| workflow: test.yml | |
| workflow_conclusion: success | |
| name: coverage-ruby3.4-rails8.0 | |
| path: docs/public/coverage/ | |
| - name: Generate YARD documentation | |
| run: | | |
| bundle exec yard doc --output-dir=docs/public/yard | |
| - name: Export TypeScript types | |
| run: | | |
| scripts/generate_structs.rb | |
| - name: Build with Next.js | |
| run: cd docs && pnpm run build | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./docs/out | |
| 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 |