Skip to content

Commit a525dc4

Browse files
committed
ci(mobile-e2e): add clerk-android snapshot-from-SHA mode + skip iOS for android gates
Adds the clerk_android_snapshot_suffix input (paired with clerk_android_ref) to the existing workflow_dispatch + workflow_call surfaces. When set, the Android job: - Checks out clerk-android at the ref - Bumps CLERK_*_VERSION by appending the suffix - Publishes to mavenLocal under those new versions - Pins packages/expo/android/build.gradle to those versions and adds mavenLocal() to the resolution chain When the suffix is empty, the existing version-string mode is preserved (clerk_android_ref is treated as a pre-published version on Maven Central / Sonatype staging). Also skips the iOS job when the dispatch is scoped to Android only (clerk_android_ref set without clerk_ios_ref), used by clerk-android's expo-compat release gate. Consolidates the snapshot-publish + iOS-skip work that previously lived on chris/mobile-e2e-android-snapshot-renovate, which will be deleted.
1 parent 58d36f7 commit a525dc4

1 file changed

Lines changed: 97 additions & 13 deletions

File tree

.github/workflows/mobile-e2e.yml

Lines changed: 97 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,11 @@ on:
3232
required: false
3333
default: ""
3434
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."
3640
required: false
3741
default: ""
3842
workflow_call:
@@ -57,6 +61,10 @@ on:
5761
type: string
5862
required: false
5963
default: ""
64+
clerk_android_snapshot_suffix:
65+
type: string
66+
required: false
67+
default: ""
6068

6169
env:
6270
EXPO_INSTANCE_NAME: clerkstage-with-native-components
@@ -107,12 +115,83 @@ jobs:
107115
echo "Pinned clerk-ios to ${IOS_REF}:"
108116
grep -nE "CLERK_IOS_VERSION|kind:|revision:" "$file" | head
109117
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 == ''
116195
env:
117196
ANDROID_REF: ${{ inputs.clerk_android_ref }}
118197
run: |
@@ -430,6 +509,11 @@ jobs:
430509
431510
ios:
432511
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 != ''
433517
runs-on: macos-15
434518
timeout-minutes: 60
435519
steps:
@@ -463,12 +547,12 @@ jobs:
463547
echo "Pinned clerk-ios to ${IOS_REF}:"
464548
grep -nE "CLERK_IOS_VERSION|kind:|revision:" "$file" | head
465549
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 == ''
472556
env:
473557
ANDROID_REF: ${{ inputs.clerk_android_ref }}
474558
run: |

0 commit comments

Comments
 (0)