feat(team): harden share pipeline — Ollama client, helper extraction, segmented sync #84
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 Core | |
| concurrency: | |
| group: ci-${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| on: | |
| push: | |
| branches: [main, dev, "feature/**"] | |
| pull_request: | |
| branches: [main, dev] | |
| jobs: | |
| test-pr: | |
| if: > | |
| github.event_name == 'pull_request' && | |
| !(github.event.pull_request.head.ref == 'dev' && github.event.pull_request.base.ref == 'main') | |
| name: PR / Tests (ubuntu) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run tests | |
| # Fast PR validation on Linux only. | |
| run: bun test test/ | |
| test-merge: | |
| if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/dev') | |
| name: Push / Tests (${{ matrix.os }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Run tests | |
| # Full cross-platform test matrix for merge branches. | |
| run: bun test test/ | |
| dev-draft-release: | |
| name: Push(dev) / Draft Release | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/dev' | |
| needs: test-merge | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Setup Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| run: bun install | |
| - name: Compute dev tag | |
| id: meta | |
| run: | | |
| bun run scripts/release-meta.ts --allow-invalid --github-output "$GITHUB_OUTPUT" | |
| DEV_TAG="${{ steps.meta.outputs.next_version }}-dev.${{ github.run_number }}" | |
| echo "dev_tag=${DEV_TAG}" >> "$GITHUB_OUTPUT" | |
| - name: Remove previous dev draft releases and tags | |
| uses: actions/github-script@v7 | |
| with: | |
| script: | | |
| const { owner, repo } = context.repo; | |
| const releases = await github.paginate(github.rest.repos.listReleases, { | |
| owner, | |
| repo, | |
| per_page: 100, | |
| }); | |
| for (const release of releases) { | |
| const isDevTag = /-dev\.\d+$/.test(release.tag_name || ""); | |
| if (isDevTag && release.draft) { | |
| await github.rest.repos.deleteRelease({ | |
| owner, | |
| repo, | |
| release_id: release.id, | |
| }); | |
| } | |
| } | |
| const refs = await github.paginate(github.rest.git.listMatchingRefs, { | |
| owner, | |
| repo, | |
| ref: "tags/v", | |
| per_page: 100, | |
| }); | |
| for (const ref of refs) { | |
| const tagName = ref.ref.replace("refs/tags/", ""); | |
| if (/-dev\.\d+$/.test(tagName)) { | |
| await github.rest.git.deleteRef({ | |
| owner, | |
| repo, | |
| ref: `tags/${tagName}`, | |
| }).catch(() => {}); | |
| } | |
| } | |
| - name: Create draft prerelease | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.meta.outputs.dev_tag }} | |
| target_commitish: ${{ github.sha }} | |
| name: Dev Draft ${{ steps.meta.outputs.dev_tag }} | |
| body: ${{ steps.meta.outputs.release_notes }} | |
| generate_release_notes: false | |
| draft: true | |
| prerelease: true | |
| auto-release: | |
| name: Push(main) / Auto Release | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
| needs: test-merge | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: recursive | |
| - name: Check if already tagged | |
| id: check | |
| run: | | |
| # Skip if this commit already has a stable version tag | |
| for tag in $(git tag --points-at HEAD 2>/dev/null); do | |
| if echo "$tag" | grep -qE '^v[0-9]+\.[0-9]+\.[0-9]+$'; then | |
| echo "skip=true" >> "$GITHUB_OUTPUT" | |
| echo "Commit already tagged as $tag, skipping." | |
| exit 0 | |
| fi | |
| done | |
| echo "skip=false" >> "$GITHUB_OUTPUT" | |
| - name: Setup Bun | |
| if: steps.check.outputs.skip != 'true' | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: latest | |
| - name: Install dependencies | |
| if: steps.check.outputs.skip != 'true' | |
| run: bun install | |
| - name: Compute release metadata | |
| if: steps.check.outputs.skip != 'true' | |
| id: meta | |
| run: | | |
| bun run scripts/release-meta.ts --allow-invalid --github-output "$GITHUB_OUTPUT" | |
| # Squash merges lose individual commit types, so if bump is | |
| # "none" but there are unreleased commits, default to patch. | |
| BUMP=$(grep '^bump=' "$GITHUB_OUTPUT" | cut -d= -f2) | |
| COUNT=$(grep '^commit_count=' "$GITHUB_OUTPUT" | cut -d= -f2) | |
| if [ "$BUMP" = "none" ] && [ "$COUNT" -gt 0 ]; then | |
| echo "Bump was 'none' with $COUNT commits — overriding to 'patch'" | |
| LATEST=$(git tag --list 'v*.*.*' --sort=-version:refname \ | |
| | grep -E '^v[0-9]+\.[0-9]+\.[0-9]+$' | head -1) | |
| if [ -n "$LATEST" ]; then | |
| IFS='.' read -r MAJ MIN PAT <<< "${LATEST#v}" | |
| NEXT="v${MAJ}.${MIN}.$((PAT + 1))" | |
| else | |
| NEXT="v0.1.0" | |
| fi | |
| echo "next_version=${NEXT}" >> "$GITHUB_OUTPUT" | |
| echo "bump=patch" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Create release | |
| if: steps.check.outputs.skip != 'true' && steps.meta.outputs.bump != 'none' | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.meta.outputs.next_version }} | |
| target_commitish: ${{ github.sha }} | |
| name: ${{ steps.meta.outputs.next_version }} | |
| body: ${{ steps.meta.outputs.release_notes }} | |
| generate_release_notes: false | |
| draft: false | |
| prerelease: false |