diff --git a/.github/workflows/internal_release.yml b/.github/workflows/internal_release.yml index dafcbbcf..9f272518 100644 --- a/.github/workflows/internal_release.yml +++ b/.github/workflows/internal_release.yml @@ -1,12 +1,12 @@ name: Internal Release -# ONE internal (dev) release for both SDKs from a single `release/*` branch — no separate -# flowvault-release branch, no two PRs. What gets published is decided by the SCOPE of changes -# (relative to main), mirroring the skyflow-js internal workflow: -# common/ or a shared root changed -> publish BOTH skyvault + flowvault -# only skyvault/ changed -> publish skyvault -# only flowvault/ changed -> publish flowvault -# (Public/beta releases stay per-product via their tag namespaces — this scope logic is internal-only.) +# Internal (dev) releases. The publish target is chosen by the RELEASE BRANCH NAME, with a +# scope-based fallback on the shared `release/*` branch: +# skyvault-release/* -> publish skyvault only +# flowvault-release/* -> publish flowvault only +# release/* -> decide by the SCOPE of changes vs main (common/ or a shared root -> +# BOTH skyvault + flowvault; only skyvault/ -> skyvault; only flowvault/ -> flowvault) +# (Public/beta releases stay per-product via their tag namespaces — this logic is internal-only.) on: push: tags-ignore: @@ -15,12 +15,14 @@ on: - "skyvault/build.gradle" - "flowvault/build.gradle" - "*.md" - # Sample apps are not shipped artifacts — a samples-only change must not trigger an internal - # (dev) release. (The scope step also treats samples/ as out-of-scope, so nothing would publish - # even if triggered; this stops the workflow from running at all for samples-only pushes.) + # Sample apps are not shipped artifacts — a samples-only (or docs-only) push must not trigger + # an internal (dev) release on any release branch; this stops the workflow from running at all + # for such pushes. (On release/*, the scope step also treats samples/ as out-of-scope.) - "samples/**" branches: - release/* + - skyvault-release/* + - flowvault-release/* jobs: internal-release: @@ -40,27 +42,42 @@ jobs: distribution: 'temurin' java-version: '17' - - name: Detect changed scope + base versions + - name: Detect scope (by branch) + base versions id: scope run: | - # Update origin/main's tracking ref explicitly, then base the merge-base on it. - # Do NOT use FETCH_HEAD here: the `git fetch --tags` below re-points FETCH_HEAD at - # the release branch, so `merge-base FETCH_HEAD HEAD` collapsed to HEAD -> empty diff - # -> both SDKs read as out-of-scope -> publish skipped. + # origin/main is needed for the base-version tags below, and for the release/* scope + # fallback. Do NOT use FETCH_HEAD: the `git fetch --tags` below re-points FETCH_HEAD at + # the release branch, which would collapse `merge-base FETCH_HEAD HEAD` to HEAD. git fetch --no-tags origin +refs/heads/main:refs/remotes/origin/main git fetch --tags --quiet - # Diff vs where this release branch diverged from main (idempotent across re-pushes). - BASE=$(git merge-base origin/main HEAD) - CHANGED=$(git diff --name-only "$BASE" HEAD) - echo "Merge-base with main: $BASE" - echo "Changed files:"; echo "$CHANGED" - # Shared roots feed BOTH SDK builds -> treat like common. - SHARED='^(common/|scripts/|build\.gradle|settings\.gradle|gradle/|gradle\.properties|gradlew|\.github/workflows/)' + # Publish target is chosen by the release branch name; release/* falls back to change scope. + # skyvault-release/* -> skyvault only + # flowvault-release/* -> flowvault only + # release/* -> scope of changes vs main (common/ or shared root -> both) sky=false; fv=false - if echo "$CHANGED" | grep -qE "$SHARED"; then sky=true; fv=true; fi - if echo "$CHANGED" | grep -qE '^skyvault/'; then sky=true; fi - if echo "$CHANGED" | grep -qE '^flowvault/'; then fv=true; fi + case "$GITHUB_REF_NAME" in + skyvault-release/*) + sky=true + echo "Branch '$GITHUB_REF_NAME' -> skyvault only" + ;; + flowvault-release/*) + fv=true + echo "Branch '$GITHUB_REF_NAME' -> flowvault only" + ;; + *) + # Diff vs where this release branch diverged from main (idempotent across re-pushes). + BASE=$(git merge-base origin/main HEAD) + CHANGED=$(git diff --name-only "$BASE" HEAD) + echo "Merge-base with main: $BASE" + echo "Changed files:"; echo "$CHANGED" + # Shared roots feed BOTH SDK builds -> treat like common. + SHARED='^(common/|scripts/|build\.gradle|settings\.gradle|gradle/|gradle\.properties|gradlew|\.github/workflows/)' + if echo "$CHANGED" | grep -qE "$SHARED"; then sky=true; fv=true; fi + if echo "$CHANGED" | grep -qE '^skyvault/'; then sky=true; fi + if echo "$CHANGED" | grep -qE '^flowvault/'; then fv=true; fi + ;; + esac # Base versions for the -dev suffix (skyvault: latest plain-semver tag on main; flowvault: latest flowvault/x.y.z). skytag=$(git describe --tags --abbrev=0 --match '[0-9]*.[0-9]*.[0-9]*' origin/main 2>/dev/null || echo "1.27.0") diff --git a/common/src/main/kotlin/Skyflow/container/Container.kt b/common/src/main/kotlin/Skyflow/container/Container.kt index 5dac141c..d2146f68 100644 --- a/common/src/main/kotlin/Skyflow/container/Container.kt +++ b/common/src/main/kotlin/Skyflow/container/Container.kt @@ -33,6 +33,10 @@ class Container internal constructor( internal val collectElements: MutableList = mutableListOf(); internal val revealElements: MutableList