Add docs for testbench-defect-service v0.1.0 #14
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: PR Preview (Surge, gated by review) | |
| on: | |
| pull_request_target: | |
| types: [opened, reopened, synchronize, ready_for_review, edited, labeled] | |
| pull_request: | |
| types: [closed] # for teardown | |
| # Token perms needed for commenting + reading artifacts | |
| permissions: | |
| contents: read | |
| issues: write | |
| pull-requests: write | |
| env: | |
| SURGE_DOMAIN_BASE: ${{ github.event.repository.name }} | |
| jobs: | |
| build: | |
| if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.draft == false }} | |
| name: Build PR | |
| runs-on: ubuntu-latest | |
| defaults: | |
| run: | |
| working-directory: ./docusaurus | |
| steps: | |
| - name: Checkout PR head (read-only) | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: ${{ github.event.pull_request.head.repo.full_name }} | |
| ref: ${{ github.event.pull_request.head.ref }} | |
| persist-credentials: false | |
| fetch-depth: 0 | |
| - name: Use Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: docusaurus/package-lock.json | |
| - name: Install deps | |
| run: npm ci | |
| - name: Build | |
| run: npm run build | |
| - name: Upload build artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: pr-build | |
| path: docusaurus/build | |
| if-no-files-found: error | |
| retention-days: 5 | |
| deploy: | |
| if: ${{ github.event_name == 'pull_request_target' && github.event.pull_request.draft == false }} | |
| name: Deploy Preview to Surge | |
| needs: build | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: preview | |
| url: ${{ steps.deployed.outputs.preview_url }} | |
| steps: | |
| - name: Download build artifact | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pr-build | |
| path: ./build | |
| - name: Install Surge CLI | |
| run: npm i -g surge | |
| - name: Compute preview domain | |
| id: dom | |
| run: | | |
| domain="${{ env.SURGE_DOMAIN_BASE }}-pr-${{ github.event.number }}.surge.sh" | |
| echo "domain=$domain" >> $GITHUB_OUTPUT | |
| - name: Deploy to Surge | |
| id: deployed | |
| env: | |
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
| run: | | |
| mkdir -p _surge/testbench-ecosystem-documentation | |
| mv build/* _surge/testbench-ecosystem-documentation/ | |
| surge --project ./_surge \ | |
| --domain ${{ steps.dom.outputs.domain }} \ | |
| --token "$SURGE_TOKEN" | |
| echo "preview_url=https://${{ steps.dom.outputs.domain }}/testbench-ecosystem-documentation/" >> $GITHUB_OUTPUT | |
| - name: Comment with preview URL | |
| uses: peter-evans/create-or-update-comment@v4 | |
| with: | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| issue-number: ${{ github.event.number }} | |
| body: | | |
| 🚀 Preview deployed to **${{ steps.deployed.outputs.preview_url }}** | |
| teardown: | |
| if: github.event_name == 'pull_request' && github.event.action == 'closed' | |
| name: Teardown Surge preview | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Install Surge CLI | |
| run: npm i -g surge | |
| - name: Compute domain | |
| id: dom | |
| run: | | |
| echo "domain=${{ github.event.repository.name }}-pr-${{ github.event.number }}.surge.sh" >> $GITHUB_OUTPUT | |
| - name: Teardown | |
| env: | |
| SURGE_TOKEN: ${{ secrets.SURGE_TOKEN }} | |
| run: | | |
| surge teardown "${{ steps.dom.outputs.domain }}" --token "$SURGE_TOKEN" || true |