Merge pull request #542 from martenrebane/MOPPAND-1380 #989
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: RIA DigiDoc Android | |
on: [push, pull_request] | |
env: | |
BUILD_NUMBER: ${{ github.run_number }} | |
jobs: | |
ubuntu: | |
name: Build on Ubuntu | |
if: contains(github.repository, 'open-eid/MOPP-Android') && contains(github.ref, 'master') | |
runs-on: ubuntu-latest | |
env: | |
APK_RELEASE_DIRECTORY: "app/build/outputs/apk/release" | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
- name: Setup environment | |
env: | |
GOOGLE_SERVICES_JSON: ${{ secrets.GOOGLE_SERVICES_JSON }} | |
run: | | |
echo "APP_VERSION_NAME=$(grep 'appVersionName=' gradle.properties | cut -d'=' -f 2 | cut -d'-' -f 1)" >> $GITHUB_ENV | |
cd ${{ github.workspace }}/app | |
echo -n "$GOOGLE_SERVICES_JSON" | base64 --decode > "google-services.json" | |
- name: Setup JDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: zulu | |
java-version: 17 | |
- name: Download Libdigidocpp Android (androidarm) artifact | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: build.yml | |
branch: master | |
name: androidarm | |
path: libdigidocpp-androidarm | |
repo: open-eid/libdigidocpp | |
- name: Download Libdigidocpp Android (androidarm64) artifact | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: build.yml | |
branch: master | |
name: androidarm64 | |
path: libdigidocpp-androidarm64 | |
repo: open-eid/libdigidocpp | |
- name: Download Libdigidocpp Android (androidx86_64) artifact | |
uses: dawidd6/action-download-artifact@v6 | |
with: | |
workflow: build.yml | |
branch: master | |
name: androidx86_64 | |
path: libdigidocpp-androidx86_64 | |
repo: open-eid/libdigidocpp | |
- name: Extract libdigidocpp artifacts | |
run: | | |
mkdir libdigidocpp-files/ | |
mv libdigidocpp-androidarm/libdigidocpp.androidarm.zip libdigidocpp-files/ | |
mv libdigidocpp-androidarm64/libdigidocpp.androidarm64.zip libdigidocpp-files/ | |
mv libdigidocpp-androidx86_64/libdigidocpp.androidx86_64.zip libdigidocpp-files/ | |
pwd | |
ls -R -laht | |
- name: Update libdigidocpp in project | |
run: | | |
pwd | |
./gradlew common-lib:updateLibdigidocpp --dir=libdigidocpp-files/ | |
./gradlew sign-lib:updateLibdigidocpp --dir=libdigidocpp-files/ | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Test and Build with Gradle | |
run: ./gradlew clean test --no-daemon fetchAndPackageDefaultConfiguration -PappVersionName=${{ env.APP_VERSION_NAME }}.${{ env.BUILD_NUMBER }} assembleRelease --info | |
- name: Sign app APK | |
uses: r0adkll/sign-android-release@v1 | |
id: signed_apk | |
with: | |
releaseDirectory: ${{ env.APK_RELEASE_DIRECTORY }} | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.SIGNING_KEY_ALIAS }} | |
keyStorePassword: ${{ secrets.KEYSTORE_PASSWORD }} | |
env: | |
BUILD_TOOLS_VERSION: "34.0.0" | |
- name: Rename APK | |
run: | | |
mv ${{ github.workspace }}/${{ env.APK_RELEASE_DIRECTORY }}/app-release-unsigned-signed.apk ${{ github.workspace }}/${{ env.APK_RELEASE_DIRECTORY }}/"RIA_DigiDoc_${{ env.APP_VERSION_NAME }}.${{ env.BUILD_NUMBER }}.apk" | |
- name: Upload APK | |
uses: actions/upload-artifact@v4 | |
if: success() | |
with: | |
name: "RIA_DigiDoc_${{ env.APP_VERSION_NAME }}.${{ env.BUILD_NUMBER }}" | |
path: ${{ github.workspace }}/${{ env.APK_RELEASE_DIRECTORY }}/RIA_DigiDoc_${{ env.APP_VERSION_NAME }}.${{ env.BUILD_NUMBER }}.apk |