Fix APK build: use Gradle setup action, generate proper wrapper
The gradlew stub and missing gradle-wrapper.jar caused CI build to fail. Now uses gradle/actions/setup-gradle@v4 to install Gradle, then generates wrapper before building. Also renames signed APK and uploads both signed and unsigned to GitHub Releases.
This commit is contained in:
parent
88b8a5d418
commit
7d453094a0
1 changed files with 23 additions and 10 deletions
33
.github/workflows/build-apk.yml
vendored
33
.github/workflows/build-apk.yml
vendored
|
|
@ -31,13 +31,19 @@ jobs:
|
||||||
- name: Setup Android SDK
|
- name: Setup Android SDK
|
||||||
uses: android-actions/setup-android@v3
|
uses: android-actions/setup-android@v3
|
||||||
|
|
||||||
|
- name: Setup Gradle
|
||||||
|
uses: gradle/actions/setup-gradle@v4
|
||||||
|
|
||||||
|
- name: Generate Gradle wrapper
|
||||||
|
working-directory: android
|
||||||
|
run: |
|
||||||
|
gradle wrapper --gradle-version=8.5
|
||||||
|
|
||||||
- name: Build APK
|
- name: Build APK
|
||||||
working-directory: android
|
working-directory: android
|
||||||
run: |
|
run: |
|
||||||
# Extract host from APP_URL for Gradle property
|
|
||||||
TWA_HOST=$(echo "${{ env.APP_URL }}" | sed 's|https://||;s|http://||;s|/.*||')
|
TWA_HOST=$(echo "${{ env.APP_URL }}" | sed 's|https://||;s|http://||;s|/.*||')
|
||||||
chmod +x gradlew 2>/dev/null || true
|
./gradlew assembleRelease -PTWA_HOST="${TWA_HOST}"
|
||||||
./gradlew assembleRelease -PTWA_HOST="${TWA_HOST}" || echo "::warning::Gradle build failed — ensure Android SDK and gradle wrapper are set up"
|
|
||||||
|
|
||||||
- name: Sign APK
|
- name: Sign APK
|
||||||
if: success()
|
if: success()
|
||||||
|
|
@ -49,13 +55,22 @@ jobs:
|
||||||
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
alias: ${{ secrets.ANDROID_KEY_ALIAS }}
|
||||||
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
keyStorePassword: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }}
|
||||||
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
keyPassword: ${{ secrets.ANDROID_KEY_PASSWORD }}
|
||||||
continue-on-error: true
|
|
||||||
|
- name: Rename signed APK
|
||||||
|
if: steps.sign.outcome == 'success'
|
||||||
|
run: |
|
||||||
|
SIGNED=$(find android/app/build/outputs/apk/release -name "*-signed.apk" | head -1)
|
||||||
|
if [ -n "$SIGNED" ]; then
|
||||||
|
cp "$SIGNED" android/app/build/outputs/apk/release/PedScribe-v${{ github.ref_name }}-signed.apk
|
||||||
|
fi
|
||||||
|
|
||||||
- name: Upload APK to Release
|
- name: Upload APK to Release
|
||||||
if: startsWith(github.ref, 'refs/tags/')
|
if: startsWith(github.ref, 'refs/tags/')
|
||||||
uses: softprops/action-gh-release@v2
|
uses: softprops/action-gh-release@v2
|
||||||
with:
|
with:
|
||||||
files: android/app/build/outputs/apk/release/*.apk
|
files: |
|
||||||
|
android/app/build/outputs/apk/release/*-signed.apk
|
||||||
|
android/app/build/outputs/apk/release/app-release-unsigned.apk
|
||||||
generate_release_notes: true
|
generate_release_notes: true
|
||||||
|
|
||||||
- name: Upload artifact
|
- name: Upload artifact
|
||||||
|
|
@ -65,14 +80,12 @@ jobs:
|
||||||
name: pediatric-scribe-apk
|
name: pediatric-scribe-apk
|
||||||
path: android/app/build/outputs/apk/release/*.apk
|
path: android/app/build/outputs/apk/release/*.apk
|
||||||
retention-days: 30
|
retention-days: 30
|
||||||
if-no-files-found: warn
|
|
||||||
|
|
||||||
- name: Summary
|
- name: Summary
|
||||||
run: |
|
run: |
|
||||||
echo "### TWA APK Build" >> $GITHUB_STEP_SUMMARY
|
echo "### TWA APK Build" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "Built for: ${{ env.APP_URL }}" >> $GITHUB_STEP_SUMMARY
|
echo "Built for: ${{ env.APP_URL }}" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "" >> $GITHUB_STEP_SUMMARY
|
echo "" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "**Obtainium setup:**" >> $GITHUB_STEP_SUMMARY
|
echo "**Install options:**" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "1. Add repo URL: \`https://github.com/ifedan-ed/pediatric-ai-scribe-v3\`" >> $GITHUB_STEP_SUMMARY
|
echo "- Download from GitHub Releases" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "2. Source: GitHub Releases" >> $GITHUB_STEP_SUMMARY
|
echo "- Obtainium: add repo \`https://github.com/ifedan-ed/pediatric-ai-scribe-v3\`" >> $GITHUB_STEP_SUMMARY
|
||||||
echo "3. APK auto-updates on new \`v*\` tags" >> $GITHUB_STEP_SUMMARY
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue