Skip to content

~95% on SimpleQA (e.g. Qwen3.6-27B on a 3090). Supports all local and cloud LLMs (llama.cpp, Ollama, Google, ...). 10+ search engines - arXiv, PubMed, your private documents. Everything Local & Encrypted.

ci: gate release workflow behind version-change check + concurrency guard (#2337)

LearningCircuitf2ea62d92afd
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 214b5ff56b..d286431e07 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -10,8 +10,74 @@ on:
permissions: {} # Minimal permissions at workflow level for OSSF Scorecard
+# Prevent multiple full pipeline runs from competing for runners simultaneously.
+# cancel-in-progress: false ensures the active run completes; new runs queue (at most
+# 1 in-progress + 1 pending). Tag pushes get their own group (refs/tags/v1.2.3).
+concurrency:
+ group: ${{ github.workflow }}-${{ github.ref }}
+ cancel-in-progress: false
+
jobs:
# ============================================================================
+ # VERSION CHECK - Skip expensive jobs when the release already exists
+ # ============================================================================
+ # Lightweight pre-flight: reads __version__.py, checks if a GitHub release
+ # for that tag already exists. Tag pushes and workflow_dispatch bypass the
+ # check (always proceed). All gate jobs depend on should_release == 'true'.
+ # ============================================================================
+ version-check:
+ runs-on: ubuntu-latest
+ outputs:
+ should_release: ${{ steps.check.outputs.should_release }}
+ permissions:
+ contents: read
+ steps:
+ - name: Harden the runner (Audit all outbound calls)
+ uses: step-security/harden-runner@5ef0c079ce82195b2a36a210272d6b661572d83e # v2.14.2
+ with:
+ egress-policy: audit
+
+ - name: Sparse checkout version file
+ if: ${{ !(github.event_name == 'workflow_dispatch' || (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/'))) }}
+ uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
+ with:
+ sparse-checkout: src/local_deep_research/__version__.py
+ sparse-checkout-cone-mode: false
+ fetch-depth: 1
+ persist-credentials: false
+
+ - name: Check if release is needed
+ id: check
+ env:
+ EVENT_NAME: ${{ github.event_name }}
+ GIT_REF: ${{ github.ref }}
+ GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ # Tag pushes and manual triggers always proceed
+ if [[ "$EVENT_NAME" = "workflow_dispatch" ]] || [[ "$EVENT_NAME" = "push" && "$GIT_REF" =~ ^refs/tags/ ]]; then
+ echo "should_release=true" >> "$GITHUB_OUTPUT"
+ echo "Bypass: $EVENT_NAME on $GIT_REF — always proceed"
+ exit 0
+ fi
+
+ # For main branch pushes: check if version has an existing release
+ VERSION=$(grep -oP '(?<=__version__ = ")[^"]*' src/local_deep_research/__version__.py)
+ if [[ -z "$VERSION" ]]; then
+ echo "ERROR: Could not extract version from __version__.py" >&2
+ exit 1
+ fi
+ TAG="v${VERSION}"
+ echo "Detected version: $VERSION (tag: $TAG)"
+
+ if gh release view "$TAG" --repo "$GH_REPO" >/dev/null 2>&1; then
+ echo "should_release=false" >> "$GITHUB_OUTPUT"
+ echo "Release $TAG already exists — skipping scans"
+ else
+ echo "should_release=true" >> "$GITHUB_OUTPUT"
+ echo "Release $TAG does not exist — proceeding with scans"
+ fi
+ # ============================================================================
# SECURITY GATE - All security scans must pass before release proceeds
# ============================================================================
# This gate runs all security scans (17 checks): SAST, container/IaC,
@@ -25,6 +91,8 @@ jobs:
# (this is by design to prevent security gate bypass).
# ============================================================================
release-gate:
+ needs: [version-check]
+ if: needs.version-check.outputs.should_release == 'true'
uses: ./.github/workflows/release-gate.yml
permissions:
contents: read
@@ -39,7 +107,9 @@ jobs:
# This gate is advisory: failures are logged but the release proceeds.
# ============================================================================
test-gate:
- # Runs in parallel with release-gate (no dependency)
+ needs: [version-check]
+ if: needs.version-check.outputs.should_release == 'true'
+ # Runs in parallel with release-gate (no dependency besides version-check)
uses: ./.github/workflows/playwright-webkit-tests.yml
permissions:
contents: read
@@ -52,7 +122,9 @@ jobs:
# Must pass before any release proceeds.
# ============================================================================
e2e-test-gate:
- # Runs in parallel with release-gate (no dependency)
+ needs: [version-check]
+ if: needs.version-check.outputs.should_release == 'true'
+ # Runs in parallel with release-gate (no dependency besides version-check)
uses: ./.github/workflows/puppeteer-e2e-tests.yml
permissions:
contents: read
@@ -69,6 +141,8 @@ jobs:
# don't block releases (cosmetic viewport differences).
# ============================================================================
responsive-test-gate:
+ needs: [version-check]
+ if: needs.version-check.outputs.should_release == 'true'
uses: ./.github/workflows/responsive-ui-tests-enhanced.yml
permissions:
contents: read
@@ -80,13 +154,15 @@ jobs:
# Must pass before any release proceeds.
# ============================================================================
compat-test-gate:
- # Runs in parallel with release-gate (no dependency)
+ needs: [version-check]
+ if: needs.version-check.outputs.should_release == 'true'
+ # Runs in parallel with release-gate (no dependency besides version-check)
uses: ./.github/workflows/backwards-compatibility.yml
permissions:
contents: read
build:
- needs: [release-gate, test-gate, e2e-test-gate, responsive-test-gate, compat-test-gate]
+ needs: [version-check, release-gate, test-gate, e2e-test-gate, responsive-test-gate, compat-test-gate]
# test-gate (Playwright WebKit) and responsive-test-gate are advisory; release-gate, e2e-test-gate, and compat-test-gate are required
if: ${{ !cancelled() && needs.release-gate.result == 'success' && needs.e2e-test-gate.result == 'success' && needs.compat-test-gate.result == 'success' }}
runs-on: ubuntu-latest