From 127bf7d4e0740c1e5157e989f1b2233b2e2a2586 Mon Sep 17 00:00:00 2001 From: Lars Kiesow Date: Fri, 10 Feb 2023 20:11:47 +0100 Subject: [PATCH] Automatic test and build app This patch adds a GitHub Actions workflow which will automatically run through all steps to build the Android version of the app. This is an easy way of catching major build errors in pull requests or pushed commits. Additionally, this uploads the Android APK as build artifact. This allows anyone to easily download any build for a while. That will make it much easier for non-developers to participate in testing a new version or a specific test since the no longer have to wait for a new release. The build artifacts are a bit tricky to find, but they are easy to point out if anyone asks. --- .github/workflows/build-apk.yml | 42 +++++++++++++++++++++++++++++++++ android/gradlew | 0 2 files changed, 42 insertions(+) create mode 100644 .github/workflows/build-apk.yml mode change 100644 => 100755 android/gradlew diff --git a/.github/workflows/build-apk.yml b/.github/workflows/build-apk.yml new file mode 100644 index 00000000..b83f373f --- /dev/null +++ b/.github/workflows/build-apk.yml @@ -0,0 +1,42 @@ +name: Build APK + +on: + push: + pull_request: + +jobs: + main: + runs-on: ubuntu-latest + steps: + - name: checkout sources + uses: actions/checkout@v3 + + - name: use Node.js 16.x + uses: actions/setup-node@v3 + with: + node-version: 16 + + - name: install dependencies + run: npm ci + + - name: build Nuxt project + run: npm run generate + + - name: copy to Android project + run: npx cap sync + + - name: build Android app + run: ./android/gradlew assembleDebug -p android --no-daemon + + - name: rename apk + working-directory: android/app/build/outputs/apk/debug/ + run: | + build="$(date +%Y%m%d-%H%M%S)-$(git rev-parse --short HEAD)" + name="audiobookshelf-${build}.apk" + mv -v app-debug.apk "${name}" + + - name: upload app + uses: actions/upload-artifact@v3 + with: + name: audiobookshelf-apk + path: android/app/build/outputs/apk/debug/*.apk diff --git a/android/gradlew b/android/gradlew old mode 100644 new mode 100755