|
32 | 32 | required: false |
33 | 33 | default: "" |
34 | 34 | clerk_android_ref: |
35 | | - description: "Optional: pin clerk-android Maven coordinates to this version (e.g. '1.0.17-SNAPSHOT'). Empty = use the version pinned in android/build.gradle." |
| 35 | + description: "Optional: pin clerk-android Maven coordinates to this version (e.g. '1.0.17-SNAPSHOT'). When clerk_android_snapshot_suffix is set, this is treated as a git ref (SHA/branch/tag) of clerk-android instead, and the snapshot is published to mavenLocal at runtime. Empty = use the version pinned in android/build.gradle." |
| 36 | + required: false |
| 37 | + default: "" |
| 38 | + clerk_android_snapshot_suffix: |
| 39 | + description: "Optional: when set together with clerk_android_ref, the workflow checks out clerk-android at that ref, bumps CLERK_*_VERSION by appending this suffix (e.g. '-expo-compat-123'), publishes to mavenLocal, and pins @clerk/expo to the resulting version. Used by clerk-android's expo-compat release gate." |
36 | 40 | required: false |
37 | 41 | default: "" |
38 | 42 | workflow_call: |
|
57 | 61 | type: string |
58 | 62 | required: false |
59 | 63 | default: "" |
| 64 | + clerk_android_snapshot_suffix: |
| 65 | + type: string |
| 66 | + required: false |
| 67 | + default: "" |
60 | 68 |
|
61 | 69 | env: |
62 | 70 | EXPO_INSTANCE_NAME: clerkstage-with-native-components |
@@ -107,12 +115,83 @@ jobs: |
107 | 115 | echo "Pinned clerk-ios to ${IOS_REF}:" |
108 | 116 | grep -nE "CLERK_IOS_VERSION|kind:|revision:" "$file" | head |
109 | 117 |
|
110 | | - - name: Pin clerk-android Maven version (compat-gate mode) |
111 | | - # When the caller passes a specific clerk-android version (e.g. a |
112 | | - # SNAPSHOT or pre-release coordinate already published to Maven Central / |
113 | | - # Sonatype staging), rewrite the version constants in |
114 | | - # packages/expo/android/build.gradle. |
115 | | - if: inputs.clerk_android_ref != '' |
| 118 | + # --------------------------------------------------------------------- |
| 119 | + # clerk-android snapshot mode (compat-gate from clerk-android's release). |
| 120 | + # When clerk_android_snapshot_suffix is set, clerk_android_ref is a git |
| 121 | + # ref of clerk-android. We check it out, bump CLERK_*_VERSION in its |
| 122 | + # gradle.properties by appending the suffix, publish to mavenLocal, |
| 123 | + # then pin @clerk/expo to the resulting version + ensure mavenLocal() |
| 124 | + # is in the resolution chain. When the suffix is empty, |
| 125 | + # clerk_android_ref is a pre-published version string and the |
| 126 | + # "version-string mode" step below handles it. |
| 127 | + # --------------------------------------------------------------------- |
| 128 | + - name: Checkout clerk-android (snapshot mode) |
| 129 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix != '' |
| 130 | + uses: actions/checkout@v4 |
| 131 | + with: |
| 132 | + repository: clerk/clerk-android |
| 133 | + ref: ${{ inputs.clerk_android_ref }} |
| 134 | + path: clerk-android |
| 135 | + |
| 136 | + - name: Set up JDK 21 for clerk-android publish (snapshot mode) |
| 137 | + # clerk-android requires JDK 21 to build. The quickstart build below |
| 138 | + # uses JDK 17 — re-run setup-java to switch back after publish. |
| 139 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix != '' |
| 140 | + uses: actions/setup-java@v4 |
| 141 | + with: |
| 142 | + distribution: temurin |
| 143 | + java-version: 21 |
| 144 | + |
| 145 | + - name: Compute clerk-android snapshot versions |
| 146 | + id: android_versions |
| 147 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix != '' |
| 148 | + working-directory: clerk-android |
| 149 | + env: |
| 150 | + SUFFIX: ${{ inputs.clerk_android_snapshot_suffix }} |
| 151 | + run: | |
| 152 | + api="$(awk -F= '/^CLERK_API_VERSION=/{print $2}' gradle.properties | tr -d '[:space:]')${SUFFIX}" |
| 153 | + ui="$(awk -F= '/^CLERK_UI_VERSION=/{print $2}' gradle.properties | tr -d '[:space:]')${SUFFIX}" |
| 154 | + telemetry="$(awk -F= '/^CLERK_TELEMETRY_VERSION=/{print $2}' gradle.properties | tr -d '[:space:]')${SUFFIX}" |
| 155 | + echo "api=$api" >> "$GITHUB_OUTPUT" |
| 156 | + echo "ui=$ui" >> "$GITHUB_OUTPUT" |
| 157 | + echo "telemetry=$telemetry" >> "$GITHUB_OUTPUT" |
| 158 | + echo "Computed snapshot versions: api=$api ui=$ui telemetry=$telemetry" |
| 159 | +
|
| 160 | + - name: Publish clerk-android snapshot to mavenLocal |
| 161 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix != '' |
| 162 | + working-directory: clerk-android |
| 163 | + env: |
| 164 | + API_VERSION: ${{ steps.android_versions.outputs.api }} |
| 165 | + UI_VERSION: ${{ steps.android_versions.outputs.ui }} |
| 166 | + TELEMETRY_VERSION: ${{ steps.android_versions.outputs.telemetry }} |
| 167 | + run: | |
| 168 | + sed -i "s/^CLERK_API_VERSION=.*/CLERK_API_VERSION=${API_VERSION}/" gradle.properties |
| 169 | + sed -i "s/^CLERK_UI_VERSION=.*/CLERK_UI_VERSION=${UI_VERSION}/" gradle.properties |
| 170 | + sed -i "s/^CLERK_TELEMETRY_VERSION=.*/CLERK_TELEMETRY_VERSION=${TELEMETRY_VERSION}/" gradle.properties |
| 171 | + chmod +x gradlew |
| 172 | + ./gradlew :source:api:publishToMavenLocal :source:ui:publishToMavenLocal :source:telemetry:publishToMavenLocal -x signMavenPublication |
| 173 | +
|
| 174 | + - name: Pin @clerk/expo to mavenLocal snapshot |
| 175 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix != '' |
| 176 | + env: |
| 177 | + API_VERSION: ${{ steps.android_versions.outputs.api }} |
| 178 | + UI_VERSION: ${{ steps.android_versions.outputs.ui }} |
| 179 | + run: | |
| 180 | + file="packages/expo/android/build.gradle" |
| 181 | + sed -i "s|clerkAndroidApiVersion = \"[^\"]*\"|clerkAndroidApiVersion = \"${API_VERSION}\"|" "$file" |
| 182 | + sed -i "s|clerkAndroidUiVersion = \"[^\"]*\"|clerkAndroidUiVersion = \"${UI_VERSION}\"|" "$file" |
| 183 | + if ! grep -q "mavenLocal()" "$file"; then |
| 184 | + sed -i '/^repositories\s*{/a \ mavenLocal()' "$file" || true |
| 185 | + fi |
| 186 | + echo "Pinned @clerk/expo (snapshot mode):" |
| 187 | + grep -nE "clerkAndroid(Api|Ui)Version|mavenLocal" "$file" | head |
| 188 | +
|
| 189 | + - name: Pin clerk-android Maven version (version-string mode) |
| 190 | + # When the caller passes a pre-published clerk-android version |
| 191 | + # (e.g. "1.0.17-SNAPSHOT" already on Maven Central / Sonatype staging), |
| 192 | + # rewrite the version constants in packages/expo/android/build.gradle. |
| 193 | + # The snapshot-from-SHA path is handled separately above (Android job). |
| 194 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix == '' |
116 | 195 | env: |
117 | 196 | ANDROID_REF: ${{ inputs.clerk_android_ref }} |
118 | 197 | run: | |
@@ -430,6 +509,11 @@ jobs: |
430 | 509 |
|
431 | 510 | ios: |
432 | 511 | name: iOS |
| 512 | + # Skip iOS when the dispatch is scoped to Android only — used by |
| 513 | + # clerk-android's expo-compat release gate, which passes clerk_android_ref |
| 514 | + # (and clerk_android_snapshot_suffix) but not clerk_ios_ref. Manual |
| 515 | + # dispatches without ref inputs still run both jobs. |
| 516 | + if: inputs.clerk_android_ref == '' || inputs.clerk_ios_ref != '' |
433 | 517 | runs-on: macos-15 |
434 | 518 | timeout-minutes: 60 |
435 | 519 | steps: |
@@ -463,12 +547,12 @@ jobs: |
463 | 547 | echo "Pinned clerk-ios to ${IOS_REF}:" |
464 | 548 | grep -nE "CLERK_IOS_VERSION|kind:|revision:" "$file" | head |
465 | 549 |
|
466 | | - - name: Pin clerk-android Maven version (compat-gate mode) |
467 | | - # When the caller passes a specific clerk-android version (e.g. a |
468 | | - # SNAPSHOT or pre-release coordinate already published to Maven Central / |
469 | | - # Sonatype staging), rewrite the version constants in |
470 | | - # packages/expo/android/build.gradle. |
471 | | - if: inputs.clerk_android_ref != '' |
| 550 | + - name: Pin clerk-android Maven version (version-string mode) |
| 551 | + # When the caller passes a pre-published clerk-android version |
| 552 | + # (e.g. "1.0.17-SNAPSHOT" already on Maven Central / Sonatype staging), |
| 553 | + # rewrite the version constants in packages/expo/android/build.gradle. |
| 554 | + # The snapshot-from-SHA path is handled separately above (Android job). |
| 555 | + if: inputs.clerk_android_ref != '' && inputs.clerk_android_snapshot_suffix == '' |
472 | 556 | env: |
473 | 557 | ANDROID_REF: ${{ inputs.clerk_android_ref }} |
474 | 558 | run: | |
|
0 commit comments