From 8b1c2f2d9fbd916311fc7cc35ab5b8567a3f045e Mon Sep 17 00:00:00 2001 From: fboucher-os Date: Sat, 5 Sep 2026 08:14:20 -0400 Subject: [PATCH] ci: include version in android apk filename --- .github/workflows/build-android-apk.yml | 27 +++++++++++++++++++++++++ docs/maui-android-install.md | 2 +- 2 files changed, 28 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-android-apk.yml b/.github/workflows/build-android-apk.yml index 9943b68..3c0d842 100644 --- a/.github/workflows/build-android-apk.yml +++ b/.github/workflows/build-android-apk.yml @@ -48,6 +48,33 @@ jobs: ANDROID_KEYSTORE_ALIAS: ${{ secrets.ANDROID_KEYSTORE_ALIAS }} ANDROID_KEYSTORE_PASSWORD: ${{ secrets.ANDROID_KEYSTORE_PASSWORD }} + - name: Rename APK with version + run: | + if [[ "${{ github.ref }}" == refs/tags/v* ]]; then + VERSION="${{ github.ref_name }}" + else + VERSION_NUM=$(grep -oPm1 "(?<=)[^<]+" src/NoteBookmark.MauiApp/NoteBookmark.MauiApp.csproj || true) + if [ -z "$VERSION_NUM" ]; then + VERSION_NUM=$(grep -oPm1 "(?<=)[^<]+" Directory.Build.props) + fi + VERSION="v${VERSION_NUM#v}" + fi + echo "Using version: $VERSION" + + PUBLISH_DIR="src/NoteBookmark.MauiApp/bin/Release/net10.0-android/publish" + for apk in "$PUBLISH_DIR"/*.apk; do + if [ -f "$apk" ]; then + filename=$(basename "$apk") + if [[ "$filename" == *"-Signed.apk" ]]; then + new_filename="${filename%-Signed.apk}-${VERSION}-Signed.apk" + else + new_filename="${filename%.apk}-${VERSION}.apk" + fi + echo "Renaming $apk to $PUBLISH_DIR/$new_filename" + mv "$apk" "$PUBLISH_DIR/$new_filename" + fi + done + - name: Upload APK artifact uses: actions/upload-artifact@v4 with: diff --git a/docs/maui-android-install.md b/docs/maui-android-install.md index 101cefd..8aa9ebf 100644 --- a/docs/maui-android-install.md +++ b/docs/maui-android-install.md @@ -9,7 +9,7 @@ This guide walks you through installing (often called "sideloading") the NoteBoo 2. Tap on the **Actions** tab at the top. 3. Select the latest successful **Build Android APK** run. 4. Scroll down to the **Artifacts** section and download the **`notebookmark-android-apk`** ZIP file. -5. Extract the ZIP file to retrieve the **`.apk`** installer file (e.g., `NoteBookmark.MauiApp.apk`). +5. Extract the ZIP file to retrieve the **`.apk`** installer file (e.g., `c5m.notebookmark.mauiapp-v1.4.2-Signed.apk`). ---