Skip to content

Commit 19c5324

Browse files
eriedclaude
andcommitted
CI: also build and ship wear APK on branches with wear/
Branches that include the wear/ module (today: wear-os-watch-ultra) now build :wear:assembleDebug alongside :app:assembleDebug, upload it as a workflow artifact, and attach it to the rolling pre-release as a second APK named EUC-Planet-<branch>-<sha>-wear.apk. Branches without a wear module are unaffected — the build step skips the wear target and the release glob just picks up the phone APK as before. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent a1a0dc2 commit 19c5324

1 file changed

Lines changed: 30 additions & 6 deletions

File tree

.github/workflows/branch-apk.yml

Lines changed: 30 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,16 @@ jobs:
4444
- name: Make gradlew executable
4545
run: chmod +x ./gradlew
4646

47-
- name: Build debug APK
48-
run: ./gradlew :app:assembleDebug --no-daemon --stacktrace
47+
- name: Build debug APKs
48+
# Build the phone APK on every branch. Build the wear APK too when
49+
# the branch has a wear/ module (currently only wear-os-watch-ultra),
50+
# so testers can grab both halves from the same rolling release.
51+
run: |
52+
targets=":app:assembleDebug"
53+
if [ -f wear/build.gradle.kts ]; then
54+
targets="$targets :wear:assembleDebug"
55+
fi
56+
./gradlew $targets --no-daemon --stacktrace
4957
env:
5058
GRADLE_OPTS: -Xmx4g -Dorg.gradle.jvmargs=-Xmx4g
5159

@@ -57,6 +65,7 @@ jobs:
5765
SHORT_SHA="$(git rev-parse --short HEAD)"
5866
TAG="branch-${BRANCH}"
5967
APK_NAME="EUC-Planet-${BRANCH}-${SHORT_SHA}.apk"
68+
WEAR_APK_NAME="EUC-Planet-${BRANCH}-${SHORT_SHA}-wear.apk"
6069
6170
# Pull the per-branch description if BRANCH.md exists, otherwise
6271
# fall back to a generic notice. This becomes the release body header.
@@ -91,20 +100,34 @@ jobs:
91100
echo "short_sha=${SHORT_SHA}" >> "$GITHUB_OUTPUT"
92101
echo "tag=${TAG}" >> "$GITHUB_OUTPUT"
93102
echo "apk_name=${APK_NAME}" >> "$GITHUB_OUTPUT"
103+
echo "wear_apk_name=${WEAR_APK_NAME}" >> "$GITHUB_OUTPUT"
94104
95-
- name: Rename APK for release
105+
- name: Rename APKs for release
96106
if: github.event_name != 'pull_request'
97107
run: |
98108
cp app/build/outputs/apk/debug/app-debug.apk \
99109
"/tmp/${{ steps.meta.outputs.apk_name }}"
110+
# Wear APK only exists on branches that have a wear/ module.
111+
if [ -f wear/build/outputs/apk/debug/wear-debug.apk ]; then
112+
cp wear/build/outputs/apk/debug/wear-debug.apk \
113+
"/tmp/${{ steps.meta.outputs.wear_apk_name }}"
114+
fi
100115
101-
- name: Upload APK as workflow artifact
116+
- name: Upload phone APK as workflow artifact
102117
uses: actions/upload-artifact@v4
103118
with:
104119
name: app-debug-${{ github.run_id }}
105120
path: app/build/outputs/apk/debug/app-debug.apk
106121
retention-days: 90
107122

123+
- name: Upload wear APK as workflow artifact
124+
if: hashFiles('wear/build/outputs/apk/debug/wear-debug.apk') != ''
125+
uses: actions/upload-artifact@v4
126+
with:
127+
name: wear-debug-${{ github.run_id }}
128+
path: wear/build/outputs/apk/debug/wear-debug.apk
129+
retention-days: 90
130+
108131
- name: Strip prior APKs from rolling release
109132
if: github.event_name != 'pull_request'
110133
env:
@@ -133,6 +156,7 @@ jobs:
133156
body_path: /tmp/release-body.md
134157
prerelease: true
135158
# Replace the existing tag/release on every push so testers can
136-
# always find the latest at the same URL.
159+
# always find the latest at the same URL. The glob picks up both
160+
# the phone APK and (if the branch has wear/) the watch APK.
137161
make_latest: "false"
138-
files: /tmp/${{ steps.meta.outputs.apk_name }}
162+
files: /tmp/EUC-Planet-${{ steps.meta.outputs.branch }}-${{ steps.meta.outputs.short_sha }}*.apk

0 commit comments

Comments
 (0)