From f4afcedd27923bd9d0f9b59d40afba72423e4c05 Mon Sep 17 00:00:00 2001 From: spwoodcock Date: Fri, 22 Mar 2024 16:08:17 +0000 Subject: [PATCH] build: add github workflow for custom release builds --- .github/workflows/custom_release.yml | 44 ++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/custom_release.yml diff --git a/.github/workflows/custom_release.yml b/.github/workflows/custom_release.yml new file mode 100644 index 00000000000..bd82471afdd --- /dev/null +++ b/.github/workflows/custom_release.yml @@ -0,0 +1,44 @@ +# Workflow to deploy custom builds on ODK Collect + +name: 🔧 Build and Release + +on: + release: + types: [published] + # Allow manual trigger (workflow_dispatch) + workflow_dispatch: + +jobs: + build_upload_apk: + runs-on: ubuntu-latest + permissions: + contents: write + + container: + image: docker.io/cimg/android:2023.10.1 + + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Add Robolectric Deps + run: ./download-robolectric-deps.sh + + - name: Compile Code + run: ./gradlew assembleDebug + + - name: Install Github CLI + run: | + sudo apt update + sudo apt install --no-install-recommends -y gh + + - name: Build & Upload APK + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + ./gradlew assembleSelfSignedRelease + + apk_path=$(find ./collect_app/build/outputs/apk/selfSignedRelease -name '*.apk' -type f) + echo "Generated APK file: ${apk_path}" + + gh release upload ${{ github.event.release.tag_name }} "${apk_path}"