ci: build both debug and release APKs, attach both to release
dev / Build debug APK (push) Failing after 17s
dev / Build debug APK (push) Failing after 17s
This commit is contained in:
1 parent
b95d1814f9
commit
c73cd4c816
2 files changed
+31
-20
No files matched your search
@@ -67,7 +67,7 @@ jobs:
|
||||
-keypass incido_dev_keystore \
|
||||
-dname "CN=Incido Dev, OU=Local, O=Incido, L=Local, ST=Local, C=NZ"
|
||||
|
||||
- name: Build release APK
|
||||
- name: Build debug + release APKs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||
run: |
|
||||
@@ -78,17 +78,23 @@ jobs:
|
||||
export ANDROID_HOME=/tmp/gitea-runner-work/android-sdk
|
||||
export PATH=$JAVA_HOME/bin:$ANDROID_HOME/cmdline-tools/latest/bin:$ANDROID_HOME/platform-tools:$PATH
|
||||
|
||||
# Build release APK
|
||||
./gradlew assembleRelease --no-daemon
|
||||
# Build both variants; copyReleaseApks finalizes assembleRelease and
|
||||
# drops version-stamped APKs at the repo root:
|
||||
# Incido-<version>-debug.apk
|
||||
# Incido-<version>-release.apk
|
||||
./gradlew assembleDebug assembleRelease --no-daemon
|
||||
|
||||
# Find the APK
|
||||
# Verify both files exist before proceeding
|
||||
TAG="${GITHUB_REF##*/}"
|
||||
APK=$(find app/build/outputs -name '*.apk' | head -1)
|
||||
echo "APK_PATH=$APK" >> $GITHUB_ENV
|
||||
echo "APK_NAME=$(basename $APK)" >> $GITHUB_ENV
|
||||
echo "Built APK: $APK"
|
||||
|
||||
# Create release and attach APK in one step
|
||||
- name: Create release + attach both APKs
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.TOKEN }}
|
||||
run: |
|
||||
cd repo
|
||||
TAG="${GITHUB_REF##*/}"
|
||||
VERSION="${TAG#v}"
|
||||
|
||||
echo "Creating release for tag: $TAG"
|
||||
RELEASE_ID=$(curl -s -X POST "https://git.trevena.info/api/v1/repos/nick/incido/releases" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
@@ -101,12 +107,17 @@ jobs:
|
||||
}" | python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
|
||||
echo "Release ID: $RELEASE_ID"
|
||||
|
||||
if [ -n "$RELEASE_ID" ] && [ -f "$APK" ]; then
|
||||
curl -s -X POST "https://git.trevena.info/api/v1/repos/nick/incido/releases/$RELEASE_ID/assets?name=$(basename $APK)" \
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
echo "ERROR: Failed to create release"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
for APK in "Incido-${VERSION}-debug.apk" "Incido-${VERSION}-release.apk"; do
|
||||
echo "Attaching $APK to release $RELEASE_ID"
|
||||
RESPONSE=$(curl -s -X POST \
|
||||
"https://git.trevena.info/api/v1/repos/nick/incido/releases/$RELEASE_ID/assets?name=$APK" \
|
||||
-H "Authorization: token $GITHUB_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$APK"
|
||||
echo "APK $(basename $APK) attached to release $TAG"
|
||||
else
|
||||
echo "WARNING: Could not attach APK (release_id=$RELEASE_ID, apk_exists=$(test -f '$APK' && echo yes || echo no))"
|
||||
fi
|
||||
--data-binary "@$APK")
|
||||
echo "Attach response: $RESPONSE"
|
||||
done
|
||||
Reference in new issue
Block a user