fix(release): support protected branch publishing #622
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: ci | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| jobs: | |
| changes: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| docs_only: ${{ steps.classify.outputs.docs_only }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - id: classify | |
| shell: bash | |
| run: | | |
| set -euo pipefail | |
| if [[ "${{ github.event_name }}" == "pull_request" ]]; then | |
| base="${{ github.event.pull_request.base.sha }}" | |
| head="${{ github.event.pull_request.head.sha }}" | |
| else | |
| base="${{ github.event.before }}" | |
| head="${{ github.sha }}" | |
| fi | |
| if [[ -z "$base" || "$base" =~ ^0+$ ]]; then | |
| echo "docs_only=false" >> "$GITHUB_OUTPUT" | |
| echo "No reliable base commit; keeping windows-smoke enabled." >> "$GITHUB_STEP_SUMMARY" | |
| exit 0 | |
| fi | |
| mapfile -t files < <(git diff --name-only "$base" "$head") | |
| docs_only=true | |
| for file in "${files[@]}"; do | |
| case "$file" in | |
| *.md|*.mdx|CHANGELOG|LICENSE|docs/*|llms.txt|llms-full.txt|skills/*|site/*|tests/docs/*) | |
| ;; | |
| *) | |
| docs_only=false | |
| ;; | |
| esac | |
| done | |
| echo "docs_only=$docs_only" >> "$GITHUB_OUTPUT" | |
| { | |
| echo "### Change classification" | |
| echo "" | |
| echo "docs_only=$docs_only" | |
| echo "" | |
| printf -- "- %s\n" "${files[@]}" | |
| } >> "$GITHUB_STEP_SUMMARY" | |
| core: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| # Workspaces install also links examples/* against the root package, so | |
| # the branded-cli smoke test exercises the example exactly as a reader | |
| # would run it. | |
| - run: npm ci | |
| - run: npm run typecheck | |
| - run: npm run build | |
| # Full suite — includes the docs/platform drift guard (registry vs | |
| # README/llms/site data) and the examples smoke test, so doc rot and a | |
| # broken example FAIL CI instead of shipping. | |
| - run: npm test | |
| site: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: | | |
| package-lock.json | |
| site/package-lock.json | |
| - run: npm ci | |
| - run: npm ci | |
| working-directory: site | |
| - run: npx tsc -b | |
| working-directory: site | |
| - run: npm run build | |
| working-directory: site | |
| windows-smoke: | |
| needs: changes | |
| if: needs.changes.outputs.docs_only != 'true' | |
| # Native-Windows is a hard project constraint (no symlink installs, .cmd | |
| # launcher, PATHEXT spawn). The full suite is Windows-green; run it on | |
| # windows-latest so regressions surface in CI, not on user machines. | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| - run: npm ci | |
| - run: npm run build | |
| - run: npm test |