Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

ci: don't cancel in-flight docs and release runs on main (#9328)

Akshay Agrawalab81cdf01568
diff --git a/.github/workflows/docs.yml b/.github/workflows/docs.yml
index 45e3c7a14e..4e21cc25fe 100644
--- a/.github/workflows/docs.yml
+++ b/.github/workflows/docs.yml
@@ -8,8 +8,8 @@ on:
workflow_dispatch: {}
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
+ group: ${{ github.workflow }}-${{ github.run_id }}
+ cancel-in-progress: false
permissions:
contents: read
@@ -69,8 +69,25 @@ jobs:
- name: 📚 CLAUDE.md
run: cp docs/_static/CLAUDE.md .vercel/output/static/CLAUDE.md
- - name: 🚀 Deploy to Vercel
+ # Skip deploy if a newer commit has landed on main while this run was building,
+ # so an older run can't overwrite a newer deploy. The run still completes green.
+ - name: 🔍 Check if still tip of main
+ id: latest
if: github.ref == 'refs/heads/main'
+ env:
+ GH_SHA: ${{ github.sha }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ LATEST_SHA=$(git ls-remote "https://github.com/${GH_REPO}.git" refs/heads/main | awk '{print $1}')
+ if [ "$LATEST_SHA" = "$GH_SHA" ]; then
+ echo "is_latest=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "is_latest=false" >> "$GITHUB_OUTPUT"
+ echo "::notice::Skipping deploy — superseded by a newer commit on main ($LATEST_SHA)."
+ fi
+
+ - name: 🚀 Deploy to Vercel
+ if: github.ref == 'refs/heads/main' && steps.latest.outputs.is_latest == 'true'
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
env:
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
diff --git a/.github/workflows/release-dev.yml b/.github/workflows/release-dev.yml
index 3b714da7ca..2c0e89ebe5 100644
--- a/.github/workflows/release-dev.yml
+++ b/.github/workflows/release-dev.yml
@@ -127,9 +127,39 @@ jobs:
path: frontend/
retention-days: 1
+ # Recheck after the build completes before publishing to npm. The `dev` dist-tag is
+ # mutable — if a stale older run publishes after a newer one, `@dev` gets pointed at
+ # older artifacts. Always runs; returns is_latest=true for non-main callers so this
+ # reusable workflow stays safe outside the push-to-main path.
+ recheck_tip_of_main:
+ name: 🔍 Still tip of main?
+ needs: publish_dev_release
+ runs-on: ubuntu-latest
+ outputs:
+ is_latest: ${{ steps.check.outputs.is_latest }}
+ steps:
+ - id: check
+ env:
+ GH_REF: ${{ github.ref }}
+ GH_SHA: ${{ github.sha }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ if [ "$GH_REF" != "refs/heads/main" ]; then
+ echo "is_latest=true" >> "$GITHUB_OUTPUT"
+ exit 0
+ fi
+ LATEST_SHA=$(git ls-remote "https://github.com/${GH_REPO}.git" refs/heads/main | awk '{print $1}')
+ if [ "$LATEST_SHA" = "$GH_SHA" ]; then
+ echo "is_latest=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "is_latest=false" >> "$GITHUB_OUTPUT"
+ echo "::notice::Skipping npm publish — superseded by a newer commit on main ($LATEST_SHA) during build."
+ fi
+
publish_wasm_dev:
name: 📤 Publish @marimo-team/frontend to npm
- needs: publish_dev_release
+ needs: [publish_dev_release, recheck_tip_of_main]
+ if: needs.recheck_tip_of_main.outputs.is_latest == 'true'
uses: ./.github/workflows/publish-npm.yml
with:
package-artifact-name: frontend-dev
@@ -141,7 +171,8 @@ jobs:
publish_islands_dev:
name: 📤 Publish @marimo-team/islands to npm
- needs: publish_dev_release
+ needs: [publish_dev_release, recheck_tip_of_main]
+ if: needs.recheck_tip_of_main.outputs.is_latest == 'true'
uses: ./.github/workflows/publish-npm.yml
with:
package-artifact-name: frontend-islands-dev
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index 95b74afe97..66e2467d5e 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -13,8 +13,11 @@ on:
workflow_dispatch: {}
concurrency:
- group: ${{ github.workflow }}-${{ github.ref }}
- cancel-in-progress: true
+ # On main: unique group per run so nothing is cancelled (avoids a red X on the commit
+ # when a newer push supersedes this one). On tags: per-ref group with cancel-in-progress,
+ # preserving the original production-release behavior.
+ group: ${{ github.workflow }}-${{ github.ref == 'refs/heads/main' && github.run_id || github.ref }}
+ cancel-in-progress: ${{ github.ref != 'refs/heads/main' }}
jobs:
# ── Production Release (tag push) ──────────────────────────────
@@ -72,19 +75,67 @@ jobs:
# ── Development Release (push to main) ─────────────────────────
+ # Skip the dev release chain if a newer commit has landed on main while this run was
+ # queued, so we don't burn a TestPyPI version on a superseded SHA. Downstream dev jobs
+ # (build_dev + publish_dev_*) skip automatically via their `needs:` chain.
+ check_dev_latest:
+ name: 🔍 Still tip of main?
+ if: github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ outputs:
+ is_latest: ${{ steps.check.outputs.is_latest }}
+ steps:
+ - id: check
+ env:
+ GH_SHA: ${{ github.sha }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ LATEST_SHA=$(git ls-remote "https://github.com/${GH_REPO}.git" refs/heads/main | awk '{print $1}')
+ if [ "$LATEST_SHA" = "$GH_SHA" ]; then
+ echo "is_latest=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "is_latest=false" >> "$GITHUB_OUTPUT"
+ echo "::notice::Skipping dev release — superseded by a newer commit on main ($LATEST_SHA)."
+ fi
+
build_dev:
name: 🔧 Development Release
- if: github.ref == 'refs/heads/main'
+ needs: check_dev_latest
+ if: github.ref == 'refs/heads/main' && needs.check_dev_latest.outputs.is_latest == 'true'
uses: ./.github/workflows/release-dev.yml
secrets: inherit
permissions:
contents: read # Required for checkout
id-token: write # Required for nodejs OIDC
+ # Recheck after the build completes: the build takes several minutes, long enough that
+ # a newer commit may have landed during that window. Skipping here prevents a stale
+ # older run from publishing to TestPyPI after the newer run has already published.
+ recheck_dev_latest:
+ name: 🔍 Recheck still tip of main?
+ needs: build_dev
+ if: github.ref == 'refs/heads/main'
+ runs-on: ubuntu-latest
+ outputs:
+ is_latest: ${{ steps.check.outputs.is_latest }}
+ steps:
+ - id: check
+ env:
+ GH_SHA: ${{ github.sha }}
+ GH_REPO: ${{ github.repository }}
+ run: |
+ LATEST_SHA=$(git ls-remote "https://github.com/${GH_REPO}.git" refs/heads/main | awk '{print $1}')
+ if [ "$LATEST_SHA" = "$GH_SHA" ]; then
+ echo "is_latest=true" >> "$GITHUB_OUTPUT"
+ else
+ echo "is_latest=false" >> "$GITHUB_OUTPUT"
+ echo "::notice::Skipping TestPyPI publish — superseded by a newer commit on main ($LATEST_SHA) during build."
+ fi
+
publish_dev_pypi_marimo:
name: 📤 Publish marimo to TestPyPI
- if: github.ref == 'refs/heads/main'
- needs: build_dev
+ if: github.ref == 'refs/heads/main' && needs.recheck_dev_latest.outputs.is_latest == 'true'
+ needs: [build_dev, recheck_dev_latest]
runs-on: ubuntu-latest
environment: testpypi
permissions:
@@ -104,8 +155,8 @@ jobs:
publish_dev_pypi_marimo_base:
name: 📤 Publish marimo-base to TestPyPI
- if: github.ref == 'refs/heads/main'
- needs: build_dev
+ if: github.ref == 'refs/heads/main' && needs.recheck_dev_latest.outputs.is_latest == 'true'
+ needs: [build_dev, recheck_dev_latest]
runs-on: ubuntu-latest
environment: testpypi
permissions: