Preparation release 2 #70
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: Documentation | |
| on: | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - '.github/workflows/docs.yml' | |
| pull_request: | |
| branches: | |
| - main | |
| paths: | |
| - 'docs/**' | |
| - 'mkdocs.yml' | |
| - '.github/workflows/docs.yml' | |
| permissions: | |
| contents: write | |
| pull-requests: write | |
| deployments: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| - name: Set up Python | |
| uses: actions/setup-python@v6 | |
| with: | |
| python-version: '3.13' | |
| - name: Install uv | |
| uses: astral-sh/setup-uv@v7 | |
| - name: Install dependencies | |
| run: uv sync --group docs | |
| - name: Build documentation | |
| run: uv run mkdocs build --strict | |
| - name: Upload artifact | |
| uses: actions/upload-artifact@v6.0.0 | |
| with: | |
| name: docs-site | |
| path: site/ | |
| deploy-preview: | |
| needs: build | |
| if: github.event_name == 'pull_request' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: docs-site | |
| path: site/ | |
| - name: Deploy preview | |
| uses: rossjrw/pr-preview-action@v1 | |
| with: | |
| source-dir: site/ | |
| preview-branch: gh-pages | |
| umbrella-dir: pr-preview | |
| - name: Create deployment | |
| uses: actions/github-script@v8 | |
| with: | |
| script: | | |
| const prNumber = context.issue.number; | |
| const previewUrl = `https://openrailassociation.github.io/dac-migration-dss-popupsim/pr-preview/pr-${prNumber}/`; | |
| const { data: deployment } = await github.rest.repos.createDeployment({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: context.payload.pull_request.head.sha, | |
| environment: 'pr-preview', | |
| auto_merge: false, | |
| required_contexts: [], | |
| description: `PR #${prNumber} documentation preview` | |
| }); | |
| await github.rest.repos.createDeploymentStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| deployment_id: deployment.id, | |
| state: 'success', | |
| environment_url: previewUrl, | |
| description: 'Documentation preview deployed' | |
| }); | |
| deploy-production: | |
| needs: build | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6.0.1 | |
| - name: Download artifact | |
| uses: actions/download-artifact@v7 | |
| with: | |
| name: docs-site | |
| path: site/ | |
| - name: Deploy to GitHub Pages | |
| uses: peaceiris/actions-gh-pages@v4 | |
| with: | |
| github_token: ${{ secrets.GITHUB_TOKEN }} | |
| publish_dir: ./site | |
| force_orphan: true |