Update brew install command (#47) #10
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 Docs to GitHub Pages | |
| on: | |
| push: | |
| branches: [ main ] | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/docs.yml' | |
| pull_request: | |
| types: [opened, reopened, synchronize, ready_for_review] | |
| paths: | |
| - 'docs/**' | |
| - '.github/workflows/docs.yml' | |
| workflow_dispatch: {} | |
| permissions: | |
| pages: write | |
| id-token: write | |
| contents: read | |
| concurrency: | |
| group: 'pages' | |
| cancel-in-progress: true | |
| jobs: | |
| pr-allow: | |
| name: Check PR allow | |
| runs-on: ubuntu-latest | |
| outputs: | |
| allowed: ${{ steps.check.outputs.allowed }} | |
| reason: ${{ steps.check.outputs.reason }} | |
| steps: | |
| - id: check | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const evt = context.eventName; | |
| if (evt !== 'pull_request') { | |
| core.setOutput('allowed', 'true'); | |
| core.setOutput('reason', 'not-a-pr'); | |
| return; | |
| } | |
| const pr = context.payload.pull_request; | |
| const sameRepo = pr.head.repo.full_name === pr.base.repo.full_name; | |
| let approved = false; | |
| try { | |
| const { owner, repo } = context.repo; | |
| const number = pr.number; | |
| const reviews = await github.paginate(github.rest.pulls.listReviews, { owner, repo, pull_number: number }); | |
| approved = reviews.some(r => r.state === 'APPROVED'); | |
| } catch (e) { | |
| core.info('Failed to list reviews: ' + e.message); | |
| } | |
| const allowed = sameRepo || approved; | |
| core.setOutput('allowed', allowed ? 'true' : 'false'); | |
| core.setOutput('reason', allowed ? (sameRepo ? 'same-repo' : 'approved') : 'fork-unapproved'); | |
| build: | |
| runs-on: ubuntu-latest | |
| needs: pr-allow | |
| if: needs.pr-allow.outputs.allowed == 'true' | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Install mkdocs | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install mkdocs mkdocs-material | |
| - name: Build docs with MkDocs | |
| run: mkdocs build -d site | |
| - name: Upload artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: site | |
| deploy: | |
| environment: | |
| name: github-pages | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| runs-on: ubuntu-latest | |
| needs: build | |
| # Only deploy from trusted pushes to main (never from PRs) | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| steps: | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 | |