From b2c0aab7cefe62dc253cbc7785b11fe71b65aa3d Mon Sep 17 00:00:00 2001 From: Luke Curley Date: Wed, 23 Sep 2026 16:06:53 -0700 Subject: [PATCH] fix(ci): defer wrapper releases while moq-ffi has unreleased changes Release Kotlin lib published dev.moq:moq:0.5.0 compiled against bindings generated from main, which already used TrackDemand, while the newest published dev.moq:moq-ffi (0.4.0) predates it. Swift and Python already defer in that case by diffing rs/moq-ffi against its release tag. Move that check into `release.sh ffi-unreleased` and use it from the Kotlin, Go, Swift, and Python wrapper releases. Kotlin now also chains off Release Kotlin FFI so a deferred wrapper publishes once the bindings land, and requires the exact bindings version rather than any in range. Co-Authored-By: Claude Opus 5.5 --- .github/justfile | 1 + .github/scripts/release.sh | 146 +++++------------------- .github/scripts/release.test.sh | 52 +++++++++ .github/workflows/release-go.yml | 27 ++++- .github/workflows/release-kt-lib.yml | 77 ++++++++++--- .github/workflows/release-py.yml | 22 +--- .github/workflows/release-swift-lib.yml | 41 ++----- kt/README.md | 2 +- 8 files changed, 179 insertions(+), 189 deletions(-) create mode 100755 .github/scripts/release.test.sh diff --git a/.github/justfile b/.github/justfile index 2eb5f6b866a..f341da77296 100644 --- a/.github/justfile +++ b/.github/justfile @@ -6,6 +6,7 @@ set fallback # Lint GitHub Actions workflows. check: python3 {{ source_directory() }}/scripts/install-formula.test.py + {{ source_directory() }}/scripts/release.test.sh @if command -v nfpm >/dev/null 2>&1 && command -v envsubst >/dev/null 2>&1 && command -v dpkg-deb >/dev/null 2>&1 && command -v rpm >/dev/null 2>&1; then python3 {{ source_directory() }}/../rs/scripts/package-rename.test.py; fi @if command -v actionlint >/dev/null 2>&1; then actionlint; fi {{ source_directory() }}/scripts/alert.sh check-coverage diff --git a/.github/scripts/release.sh b/.github/scripts/release.sh index b584e236bd5..8f6eb3a7e2b 100755 --- a/.github/scripts/release.sh +++ b/.github/scripts/release.sh @@ -9,7 +9,7 @@ # release.sh read-version — read `version = "x.y.z"` from a manifest # release.sh pypi-exists — check whether == is already on PyPI # release.sh maven-exists -# release.sh maven-version-in-range +# release.sh ffi-unreleased # # Environment: # GITHUB_REF — set by GitHub Actions (e.g. refs/tags/moq-relay-v1.2.3) @@ -207,26 +207,6 @@ pypi_exists() { echo "PyPI ${dist}==${version}: exists=${exists}" } -maven_path() { - local group="$1" - local artifact="$2" - echo "${group//.//}/${artifact}" -} - -maven_status() { - local url="$1" - local output="${2:-/dev/null}" - - curl -s -o "$output" -w '%{http_code}' --max-time 10 --retry 3 --retry-connrefused "$url" 2>/dev/null || true -} - -maven_emit_exists() { - local exists="$1" - if [[ -n "${GITHUB_OUTPUT:-}" ]]; then - echo "exists=${exists}" >>"$GITHUB_OUTPUT" - fi -} - # Check whether a Maven Central artifact version exists. Writes # exists=true|false to $GITHUB_OUTPUT. A 404 means unpublished; any other # non-200 status is fatal so an outage does not look like a fresh version. @@ -234,12 +214,10 @@ maven_exists() { local group="$1" local artifact="$2" local version="$3" - local path - path=$(maven_path "$group" "$artifact") - local url="https://repo1.maven.org/maven2/${path}/${version}/${artifact}-${version}.pom" + local url="https://repo1.maven.org/maven2/${group//.//}/${artifact}/${version}/${artifact}-${version}.pom" local code - code=$(maven_status "$url") + code=$(curl -s -o /dev/null -w '%{http_code}' --max-time 10 --retry 3 --retry-connrefused "$url" 2>/dev/null || true) local exists case "$code" in @@ -251,102 +229,38 @@ maven_exists() { ;; esac - maven_emit_exists "$exists" + if [[ -n "${GITHUB_OUTPUT:-}" ]]; then + echo "exists=${exists}" >>"$GITHUB_OUTPUT" + fi echo "Maven ${group}:${artifact}:${version}: exists=${exists}" } -semver_key() { - local version="${1%%[-+]*}" - local major minor patch - IFS=. read -r major minor patch <<<"$version" - printf '%06d%06d%06d\n' "${major:-0}" "${minor:-0}" "${patch:-0}" -} - -semver_ge() { - [[ "$(semver_key "$1")" > "$(semver_key "$2")" || "$(semver_key "$1")" == "$(semver_key "$2")" ]] -} - -semver_gt() { - [[ "$(semver_key "$1")" > "$(semver_key "$2")" ]] -} - -semver_le() { - [[ "$(semver_key "$1")" < "$(semver_key "$2")" || "$(semver_key "$1")" == "$(semver_key "$2")" ]] -} - -semver_lt() { - [[ "$(semver_key "$1")" < "$(semver_key "$2")" ]] -} - -version_in_range() { +# Check whether rs/moq-ffi changed since its moq-ffi-v tag. The +# wrappers build against bindings generated from this checkout but depend on +# the published moq-ffi, so releasing one while this is true can ship calls to +# FFI API that no published moq-ffi has. Callers defer instead: release-plz +# bumps and tags moq-ffi, and each language's FFI release re-triggers its +# wrapper release via workflow_run. A tag missing from the checkout (which +# needs fetch-depth: 0) means that release is mid-flight, so it counts too. +# Writes unreleased=true|false to $GITHUB_OUTPUT. +ffi_unreleased() { local version="$1" - local range="$2" - - if [[ ! "$range" =~ ^([\[\(])([^,]+),([^\]\)]+)([\]\)])$ ]]; then - echo "Unsupported Maven version range: $range" >&2 - exit 1 + local tag="moq-ffi-v${version}" + + local unreleased=false + if ! git rev-parse --verify --quiet "refs/tags/${tag}" >/dev/null; then + echo "::warning::${tag} is not tagged yet; deferring the wrapper release to the FFI release chain." + unreleased=true + elif ! git diff --quiet "$tag" HEAD -- rs/moq-ffi; then + echo "::warning::rs/moq-ffi changed since ${tag}; deferring the wrapper release to the FFI release chain." + git diff --stat "$tag" HEAD -- rs/moq-ffi + unreleased=true fi - local lower_bound="${BASH_REMATCH[1]}" - local lower="${BASH_REMATCH[2]}" - local upper="${BASH_REMATCH[3]}" - local upper_bound="${BASH_REMATCH[4]}" - - if [[ "$lower_bound" == "[" ]]; then - semver_ge "$version" "$lower" || return 1 - else - semver_gt "$version" "$lower" || return 1 - fi - - if [[ "$upper_bound" == "]" ]]; then - semver_le "$version" "$upper" || return 1 - else - semver_lt "$version" "$upper" || return 1 + if [[ -n "${GITHUB_OUTPUT:-}" ]]; then + echo "unreleased=${unreleased}" >>"$GITHUB_OUTPUT" fi -} - -# Check whether Maven Central metadata contains any version in a Gradle-style -# half-open range such as [0.3,0.4). Writes exists=true|false to $GITHUB_OUTPUT. -maven_version_in_range() { - local group="$1" - local artifact="$2" - local range="$3" - local path - path=$(maven_path "$group" "$artifact") - local url="https://repo1.maven.org/maven2/${path}/maven-metadata.xml" - - local body - body=$(mktemp) - - local code - code=$(maven_status "$url" "$body") - - case "$code" in - 200) ;; - 404) - maven_emit_exists false - echo "Maven ${group}:${artifact} has version in ${range}: exists=false" - rm -f "$body" - return - ;; - *) - echo "Unexpected status $code querying $url" >&2 - exit 1 - ;; - esac - - local exists=false - local version - while IFS= read -r version; do - if version_in_range "$version" "$range"; then - exists=true - break - fi - done < <(grep -oE '[^<]+' "$body" | sed 's###g') - - rm -f "$body" - maven_emit_exists "$exists" - echo "Maven ${group}:${artifact} has version in ${range}: exists=${exists}" + echo "moq-ffi ${version}: unreleased=${unreleased}" } # Dispatch subcommands @@ -358,9 +272,9 @@ case "${1:-}" in read-version) read_version "$2" ;; pypi-exists) pypi_exists "$2" "$3" ;; maven-exists) maven_exists "$2" "$3" "$4" ;; - maven-version-in-range) maven_version_in_range "$2" "$3" "$4" ;; + ffi-unreleased) ffi_unreleased "$2" ;; *) - echo "Usage: $0 {parse-version|prev-tag|create|git-tag-exists|read-version|pypi-exists|maven-exists|maven-version-in-range} " >&2 + echo "Usage: $0 {parse-version|prev-tag|create|git-tag-exists|read-version|pypi-exists|maven-exists|ffi-unreleased} " >&2 exit 1 ;; esac diff --git a/.github/scripts/release.test.sh b/.github/scripts/release.test.sh new file mode 100755 index 00000000000..370722aaa1c --- /dev/null +++ b/.github/scripts/release.test.sh @@ -0,0 +1,52 @@ +#!/usr/bin/env bash +# Tests `release.sh ffi-unreleased`, the gate that keeps wrapper releases from +# shipping calls to FFI API that no published moq-ffi has. +set -euo pipefail + +release="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/release.sh" + +tmp="$(mktemp -d)" +trap 'rm -rf "$tmp"' EXIT +cd "$tmp" + +git init -q +git config user.email test@example.com +git config user.name test +git config commit.gpgsign false +git config tag.gpgsign false + +mkdir -p rs/moq-ffi py +echo a >rs/moq-ffi/lib.rs +git add . && git commit -qm init +git tag moq-ffi-v0.1.0 + +expect() { + local want="$1" + local version="$2" + local out="$tmp/output" + : >"$out" + GITHUB_OUTPUT="$out" "$release" ffi-unreleased "$version" >/dev/null + local got + got=$(cat "$out") + if [[ "$got" != "unreleased=$want" ]]; then + echo "ffi-unreleased $version: want unreleased=$want, got '$got'" >&2 + exit 1 + fi +} + +expect false 0.1.0 + +# Changes outside rs/moq-ffi don't affect the published bindings. +echo b >py/wrapper.py +git add . && git commit -qm wrapper +expect false 0.1.0 + +# A version bumped but not yet tagged means its release is mid-flight. +expect true 0.2.0 + +# FFI changes merged after the tag, before the next release. +echo b >rs/moq-ffi/lib.rs +git add . && git commit -qm ffi +expect true 0.1.0 + +echo "release.sh ffi-unreleased: ok" diff --git a/.github/workflows/release-go.yml b/.github/workflows/release-go.yml index 5c9a28c21e1..0f87ed9b743 100644 --- a/.github/workflows/release-go.yml +++ b/.github/workflows/release-go.yml @@ -11,8 +11,9 @@ name: Release Go # * push to main — a wrapper API or VERSION change. The ffi require is # pinned to the current crate version, whose mirror tag # already exists in steady state. If it's missing (a -# release is mid-flight), the job skips: the -# workflow_run below republishes once the ffi lands. +# release is mid-flight) or rs/moq-ffi changed since +# its tag, the job skips: the workflow_run below +# republishes once the ffi lands. # * Release Go FFI done — a new ffi just published to the moq-go-ffi mirror. # Re-cut the wrapper so `moq.dev/moq@latest` floats to # the newest native core (Go MVS won't float on its own). @@ -61,6 +62,8 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 with: + # Tags, for the unreleased ffi check. + fetch-depth: 0 persist-credentials: false - uses: actions/setup-go@b7ad1dad31e06c5925ef5d2fc7ad053ef454303e # v7.0.0 @@ -95,9 +98,17 @@ jobs: fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" - # On a main push the wrapper pins the current crate's ffi, whose mirror tag - # already exists in steady state. If it's missing, a release is mid-flight - # (release-plz merged but Release Go FFI hasn't published yet): skip, since + # On a main push the wrapper pins the current crate's ffi version, but it + # may call API added to rs/moq-ffi since that version was tagged. + - name: Check for unreleased ffi changes (push only) + id: ffi-diff + if: github.event_name == 'push' + env: + FFI_VERSION: ${{ steps.ffi.outputs.version }} + run: .github/scripts/release.sh ffi-unreleased "$FFI_VERSION" + + # Skip on unreleased ffi changes, and when the pinned ffi's mirror tag is + # missing (release-plz merged but Release Go FFI hasn't published yet): # the workflow_run trigger republishes once the ffi lands. One existence # check, no polling. workflow_run runs are chained after that publish, so # the tag is guaranteed present and this gate doesn't run for them. @@ -106,7 +117,13 @@ jobs: if: github.event_name == 'push' env: FFI_VERSION: ${{ steps.ffi.outputs.version }} + FFI_UNRELEASED: ${{ steps.ffi-diff.outputs.unreleased }} run: | + if [[ "$FFI_UNRELEASED" == "true" ]]; then + echo "skip=true" >> "$GITHUB_OUTPUT" + exit 0 + fi + # Distinguish "tag absent" from a lookup failure: a network error must # fail loudly, not masquerade as "defer" (nothing retries a wrapper-only # push, so a silent skip would drop the release). diff --git a/.github/workflows/release-kt-lib.yml b/.github/workflows/release-kt-lib.yml index 8e52c9a15ee..d1357543296 100644 --- a/.github/workflows/release-kt-lib.yml +++ b/.github/workflows/release-kt-lib.yml @@ -13,6 +13,11 @@ name: Release Kotlin lib # so the sibling `:moq-ffi` project compiles (the wrapper resolves it via the # project substitution in kt/moq/build.gradle.kts); native libs aren't needed # because JNA is compileOnly. +# +# Those bindings come from this checkout, so a push is deferred while rs/moq-ffi +# has changes since its release tag: the wrapper could call FFI API that no +# published moq-ffi has. Release Kotlin FFI re-triggers this workflow once the +# next moq-ffi release lands, which then publishes from that tag's commit. on: push: @@ -38,6 +43,10 @@ on: # Manual trigger so a wrapper bump can be published once the bindings it # depends on land on Maven Central (the guard below skips otherwise). workflow_dispatch: + workflow_run: + workflows: ["Release Kotlin FFI"] + types: + - completed permissions: contents: read @@ -46,6 +55,14 @@ jobs: check-version: name: Check version runs-on: ubuntu-latest + # workflow_run has the base repository's privileges, so accept only a + # successful upstream tag-push run from the expected release workflow. + if: >- + github.event_name != 'workflow_run' || + (github.repository_owner == 'moq-dev' && + github.event.workflow_run.conclusion == 'success' && + github.event.workflow_run.event == 'push' && + startsWith(github.event.workflow_run.head_branch, 'moq-ffi-v')) outputs: version: ${{ steps.version.outputs.version }} should_publish: ${{ steps.decide.outputs.should_publish }} @@ -53,6 +70,9 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: + ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} + # Tags, for the unreleased FFI check. + fetch-depth: 0 persist-credentials: false - name: Read moq.version @@ -65,36 +85,56 @@ jobs: fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" + - name: Resolve FFI version + id: ffi + env: + HEAD_BRANCH: ${{ github.event.workflow_run.head_branch }} + run: | + if [[ "$GITHUB_EVENT_NAME" == "workflow_run" ]]; then + VERSION="${HEAD_BRANCH#moq-ffi-v}" + else + VERSION=$(grep '^version' rs/moq-ffi/Cargo.toml | head -1 | sed 's/.*"\(.*\)".*/\1/') + fi + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + # workflow_run is chained after Release Kotlin FFI, so its tag is + # published. PRs run it too, so the dry-run shows whether merging would + # publish. + - name: Check for unreleased FFI changes + id: ffi-diff + if: github.event_name != 'workflow_run' + run: .github/scripts/release.sh ffi-unreleased "${{ steps.ffi.outputs.version }}" + - name: Check wrapper publication id: wrapper run: .github/scripts/release.sh maven-exists dev.moq moq "${{ steps.version.outputs.version }}" + # The bindings this checkout generates must be on Maven Central, or the + # wrapper's POM range resolves to an older moq-ffi without them. - name: Check bindings publication id: bindings - if: steps.wrapper.outputs.exists != 'true' - run: .github/scripts/release.sh maven-version-in-range dev.moq moq-ffi "[0.4,0.5)" + if: github.event_name != 'workflow_run' && steps.wrapper.outputs.exists != 'true' && steps.ffi-diff.outputs.unreleased != 'true' + run: .github/scripts/release.sh maven-exists dev.moq moq-ffi "${{ steps.ffi.outputs.version }}" - name: Decide publish id: decide + env: + VERSION: ${{ steps.version.outputs.version }} + FFI_VERSION: ${{ steps.ffi.outputs.version }} + WRAPPER_EXISTS: ${{ steps.wrapper.outputs.exists }} + FFI_UNRELEASED: ${{ steps.ffi-diff.outputs.unreleased }} + BINDINGS_EXISTS: ${{ steps.bindings.outputs.exists }} run: | - VERSION="${{ steps.version.outputs.version }}" - - if [[ "${{ steps.wrapper.outputs.exists }}" == "true" ]]; then + if [[ "$WRAPPER_EXISTS" == "true" ]]; then echo "dev.moq:moq:${VERSION} already on Maven Central; nothing to publish." echo "should_publish=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - # Bindings guard: the wrapper POM declares dev.moq:moq-ffi:[0.4,0.5), - # so don't publish a wrapper that consumers can't resolve. Require a - # compatible bindings release to exist first (it's published separately - # by release-kt-ffi.yml on a moq-ffi-v* tag). Re-run via - # workflow_dispatch once it lands. - if [[ "${{ steps.bindings.outputs.exists }}" == "true" ]]; then - echo "dev.moq:moq:${VERSION} not published yet; bindings available; will publish." + elif [[ "$FFI_UNRELEASED" == "true" ]]; then + echo "should_publish=false" >> "$GITHUB_OUTPUT" + elif [[ "$GITHUB_EVENT_NAME" == "workflow_run" || "$BINDINGS_EXISTS" == "true" ]]; then + echo "dev.moq:moq:${VERSION} not published yet; moq-ffi ${FFI_VERSION} available; will publish." echo "should_publish=true" >> "$GITHUB_OUTPUT" else - echo "::warning::dev.moq:moq-ffi has no [0.4,0.5) release on Maven Central yet; skipping wrapper publish until the bindings land (then re-run this workflow)." + echo "::warning::dev.moq:moq-ffi:${FFI_VERSION} is not on Maven Central yet; skipping wrapper publish until it lands (then re-run this workflow)." echo "should_publish=false" >> "$GITHUB_OUTPUT" fi @@ -124,6 +164,7 @@ jobs: steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 with: + ref: ${{ github.event_name == 'workflow_run' && github.event.workflow_run.head_sha || github.sha }} persist-credentials: false - name: Install Rust @@ -160,11 +201,11 @@ jobs: # holding it may have published this version since. Check again. - name: Recheck wrapper publication id: recheck - if: github.event_name == 'push' || github.event_name == 'workflow_dispatch' + if: github.event_name != 'pull_request' run: .github/scripts/release.sh maven-exists dev.moq moq "${{ needs.check-version.outputs.version }}" - name: Publish to Maven Central - if: (github.event_name == 'push' || github.event_name == 'workflow_dispatch') && steps.recheck.outputs.exists != 'true' + if: github.event_name != 'pull_request' && steps.recheck.outputs.exists != 'true' env: MOQ_VERSION: ${{ needs.check-version.outputs.version }} ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} diff --git a/.github/workflows/release-py.yml b/.github/workflows/release-py.yml index 5b21375a2b7..b2ba9f0cd2f 100644 --- a/.github/workflows/release-py.yml +++ b/.github/workflows/release-py.yml @@ -72,29 +72,13 @@ jobs: fi echo "version=$VERSION" >> "$GITHUB_OUTPUT" + # workflow_run is chained after Release Py FFI, so its tag is published. - name: Gate on published FFI id: ffi-gate + if: github.event_name == 'push' env: FFI_VERSION: ${{ steps.ffi.outputs.version }} - run: | - if [[ "$GITHUB_EVENT_NAME" == "workflow_run" ]]; then - echo "Release Py FFI completed for v${FFI_VERSION}; proceeding." - echo "unreleased=false" >> "$GITHUB_OUTPUT" - exit 0 - fi - - TAG="moq-ffi-v${FFI_VERSION}" - if ! git rev-parse --verify --quiet "refs/tags/${TAG}" >/dev/null; then - echo "::warning::missing local tag ${TAG}; deferring to the Release Py FFI chain." - echo "unreleased=true" >> "$GITHUB_OUTPUT" - exit 0 - fi - if ! git diff --quiet "$TAG" HEAD -- rs/moq-ffi; then - echo "::warning::moq-ffi has unreleased changes; deferring to the Release Py FFI chain." - echo "unreleased=true" >> "$GITHUB_OUTPUT" - else - echo "unreleased=false" >> "$GITHUB_OUTPUT" - fi + run: .github/scripts/release.sh ffi-unreleased "$FFI_VERSION" - name: Check FFI on PyPI id: ffi-pypi diff --git a/.github/workflows/release-swift-lib.yml b/.github/workflows/release-swift-lib.yml index 6e606fb65db..6c5b07fc5a5 100644 --- a/.github/workflows/release-swift-lib.yml +++ b/.github/workflows/release-swift-lib.yml @@ -67,10 +67,10 @@ jobs: outputs: version: ${{ steps.version.outputs.version }} ffi_version: ${{ steps.version.outputs.ffi_version }} - ffi_changed: ${{ steps.ffi-diff.outputs.changed }} + ffi_unreleased: ${{ steps.ffi-diff.outputs.unreleased }} # On PRs we only build (dry-run). On main/dev we publish when the version # isn't already tagged on the mirror. - publish: ${{ (github.event_name == 'push' || github.event_name == 'workflow_run') && steps.ffi-diff.outputs.changed != 'true' && steps.ffi-gate.outputs.exists == 'true' && steps.gate.outputs.exists == 'false' }} + publish: ${{ (github.event_name == 'push' || github.event_name == 'workflow_run') && steps.ffi-diff.outputs.unreleased != 'true' && steps.ffi-gate.outputs.exists == 'true' && steps.gate.outputs.exists == 'false' }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v6 @@ -94,33 +94,14 @@ jobs: echo "ffi_version=$FFI_VERSION" >> "$GITHUB_OUTPUT" echo "wrapper $VERSION, moq-ffi pin $FFI_VERSION" + # workflow_run is chained after Release Swift FFI, so its tag is published. + # PRs run it too, so the dry-run shows whether merging would publish. - name: Check for unreleased FFI changes id: ffi-diff + if: github.event_name != 'workflow_run' env: - BASE_SHA: ${{ github.event.pull_request.base.sha }} - run: | - if [[ "$GITHUB_EVENT_NAME" == "workflow_run" ]]; then - echo "changed=false" >> "$GITHUB_OUTPUT" - elif [[ "$GITHUB_EVENT_NAME" == "pull_request" ]]; then - if git diff --quiet "$BASE_SHA"...HEAD -- rs/moq-ffi; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - else - TAG="moq-ffi-v${{ steps.version.outputs.ffi_version }}" - if ! git rev-parse --verify --quiet "refs/tags/${TAG}" >/dev/null; then - echo "::warning::missing local tag ${TAG}; deferring to the Release Swift FFI chain." - echo "changed=true" >> "$GITHUB_OUTPUT" - exit 0 - fi - if git diff --quiet "$TAG" HEAD -- rs/moq-ffi; then - echo "changed=false" >> "$GITHUB_OUTPUT" - else - echo "::warning::moq-ffi has unreleased changes; deferring to the Release Swift FFI chain." - echo "changed=true" >> "$GITHUB_OUTPUT" - fi - fi + FFI_VERSION: ${{ steps.version.outputs.ffi_version }} + run: .github/scripts/release.sh ffi-unreleased "$FFI_VERSION" - name: Check FFI mirror tag id: ffi-gate @@ -129,7 +110,7 @@ jobs: run: .github/scripts/release.sh git-tag-exists moq-dev/moq-swift-ffi "$FFI_VERSION" - name: Unpublished FFI notice - if: steps.ffi-diff.outputs.changed != 'true' && steps.ffi-gate.outputs.exists != 'true' && github.event_name != 'pull_request' + if: steps.ffi-diff.outputs.unreleased != 'true' && steps.ffi-gate.outputs.exists != 'true' && github.event_name != 'pull_request' env: FFI_VERSION: ${{ steps.version.outputs.ffi_version }} run: echo "::warning::moq-swift-ffi ${FFI_VERSION} is not published; deferring to the Release Swift FFI chain." @@ -170,7 +151,7 @@ jobs: - name: Check FFI mirror tag id: ffi - if: needs.build.outputs.publish == 'true' || (github.event_name == 'pull_request' && needs.build.outputs.ffi_changed != 'true') + if: needs.build.outputs.publish == 'true' || (github.event_name == 'pull_request' && needs.build.outputs.ffi_unreleased != 'true') env: FFI_VERSION: ${{ needs.build.outputs.ffi_version }} # Treat a missing mirror repo / unreachable remote as "not published" @@ -193,11 +174,11 @@ jobs: run: ./swift/scripts/verify.sh --tarball "artifacts/moq-${BUILD_VERSION}-swift.tar.gz" - name: Skip notice - if: needs.build.outputs.ffi_changed == 'true' + if: needs.build.outputs.ffi_unreleased == 'true' run: echo "::notice::moq-ffi has unreleased changes; skipping the published-package cross-resolve and deferring wrapper publication to the FFI release chain." - name: Unpublished FFI notice - if: (needs.build.outputs.publish == 'true' || github.event_name == 'pull_request') && needs.build.outputs.ffi_changed != 'true' && steps.ffi.outputs.exists != 'true' + if: (needs.build.outputs.publish == 'true' || github.event_name == 'pull_request') && needs.build.outputs.ffi_unreleased != 'true' && steps.ffi.outputs.exists != 'true' env: FFI_VERSION: ${{ needs.build.outputs.ffi_version }} run: echo "::notice::moq-swift-ffi ${FFI_VERSION} not published yet; skipping cross-package resolve." diff --git a/kt/README.md b/kt/README.md index 03a0e62b315..b25426f977c 100644 --- a/kt/README.md +++ b/kt/README.md @@ -58,7 +58,7 @@ The `dev.moq` package is intentionally thin: Kotlin has extension functions, so ## Versioning - `moqffi.version` (gradle.properties): the bindings version. CI overrides it from the `moq-ffi-v*` tag; only used for local dev otherwise. -- `moq.version` (gradle.properties): the wrapper version, the source of truth. **Bump this by hand** to ship a new wrapper. `release-kt-lib.yml` reads it, checks whether `dev.moq:moq:` is already on Maven Central, and publishes only if it isn't. Must stay `>= 0.3.0` (the line continues from the pre-split `dev.moq:moq` releases). +- `moq.version` (gradle.properties): the wrapper version, the source of truth. **Bump this by hand** to ship a new wrapper. `release-kt-lib.yml` reads it, checks whether `dev.moq:moq:` is already on Maven Central, and publishes only if it isn't. If `rs/moq-ffi` changed since its last `moq-ffi-v*` tag, it waits and publishes after the next Release Kotlin FFI run. Must stay `>= 0.3.0` (the line continues from the pre-split `dev.moq:moq` releases). ## Local development