From b9fb86326e9c7d359e29c97d4f8af665f2e961da Mon Sep 17 00:00:00 2001 From: Adam Velebil Date: Tue, 29 Nov 2022 15:45:07 +0100 Subject: [PATCH] create scripts --- .github/workflows/android.yaml | 31 ++++------------------------ .gitignore | 1 + android/scripts/build.sh | 10 +++++++++ android/scripts/collect-artifacts.sh | 26 +++++++++++++++++++++++ 4 files changed, 41 insertions(+), 27 deletions(-) create mode 100755 android/scripts/build.sh create mode 100755 android/scripts/collect-artifacts.sh diff --git a/.github/workflows/android.yaml b/.github/workflows/android.yaml index 39b9f56e..f07f59b3 100644 --- a/.github/workflows/android.yaml +++ b/.github/workflows/android.yaml @@ -38,12 +38,8 @@ jobs: flutter analyze working-directory: ./app - - name: Generate Third party licenses - run: ./gradlew collectLicenses - working-directory: ./app/android - - name: Build the App - run: flutter build apk --release --split-per-abi && flutter build apk --release + run: android/scripts/build.sh env: YUBIOATH_STORE_BASE64: ${{ secrets.YUBIOATH_STORE_BASE64 }} YUBIOATH_KEY_ALIAS: ${{ secrets.YUBIOATH_KEY_ALIAS }} @@ -56,30 +52,11 @@ jobs: working-directory: ./app - name: Run android tests - run: | - ./gradlew test + run: ./gradlew test working-directory: ./app/android - - name: Upload artifacts - run: | - export REF=$(echo ${GITHUB_REF} | cut -d '/' -f 3,4,5,6,7 | sed -r 's/\//_/g') - export FLUTTER_APK=build/app/outputs/flutter-apk - export NATIVE_LIBS=build/app/intermediates/merged_native_libs/release/out/lib - - mkdir artifacts - mv "${FLUTTER_APK}/app-arm64-v8a-release.apk" artifacts/yubico-authenticator-arm64-v8a-${REF}.apk - mv "${FLUTTER_APK}/app-armeabi-v7a-release.apk" artifacts/yubico-authenticator-armeabi-v7a-${REF}.apk - mv "${FLUTTER_APK}/app-x86_64-release.apk" artifacts/yubico-authenticator-x86_64-${REF}.apk - mv "${FLUTTER_APK}/app-release.apk" artifacts/yubico-authenticator-${REF}.apk - - mv build/app/outputs/mapping/release/mapping.txt artifacts/ - - pushd "${NATIVE_LIBS}/" - zip -r sym-arm64-v8a.zip arm64-v8a/*so - zip -r sym-armeabi-v7a.zip armeabi-v7a/*so - zip -r sym-x86_64.zip x86_64/*so - popd - mv "${NATIVE_LIBS}/"*zip artifacts/ + - name: Collect artifacts + run: android/scripts/collect-artifacts.sh ${GITHUB_REF} working-directory: ./app - uses: actions/upload-artifact@v3 diff --git a/.gitignore b/.gitignore index 0fa6b675..6a7e6f44 100644 --- a/.gitignore +++ b/.gitignore @@ -44,3 +44,4 @@ app.*.map.json /android/app/debug /android/app/profile /android/app/release +/artifacts/ diff --git a/android/scripts/build.sh b/android/scripts/build.sh new file mode 100755 index 00000000..5c6172ea --- /dev/null +++ b/android/scripts/build.sh @@ -0,0 +1,10 @@ +#!/bin/bash -x + +# Generate Third-party licenses +pushd android +./gradlew collectLicenses +popd + +# Build flutter app +flutter build apk --release --split-per-abi +flutter build apk --release diff --git a/android/scripts/collect-artifacts.sh b/android/scripts/collect-artifacts.sh new file mode 100755 index 00000000..22c3b3cd --- /dev/null +++ b/android/scripts/collect-artifacts.sh @@ -0,0 +1,26 @@ +#!/bin/bash -x + +GITHUB_REF=`git branch --show-current` +if [ $# -gt 0 ] ; then + GITHUB_REF="$1" +fi + +export REF=$(echo ${GITHUB_REF} | cut -d '/' -f 3,4,5,6,7 | sed -r 's/\//_/g') +export FLUTTER_APK=build/app/outputs/flutter-apk +export NATIVE_LIBS=build/app/intermediates/merged_native_libs/release/out/lib + +rm -rf artifacts +mkdir artifacts +cp "${FLUTTER_APK}/app-arm64-v8a-release.apk" artifacts/yubico-authenticator-arm64-v8a-${REF}.apk +cp "${FLUTTER_APK}/app-armeabi-v7a-release.apk" artifacts/yubico-authenticator-armeabi-v7a-${REF}.apk +cp "${FLUTTER_APK}/app-x86_64-release.apk" artifacts/yubico-authenticator-x86_64-${REF}.apk +cp "${FLUTTER_APK}/app-release.apk" artifacts/yubico-authenticator-${REF}.apk + +cp build/app/outputs/mapping/release/mapping.txt artifacts/ + +pushd "${NATIVE_LIBS}/" +zip -r sym-arm64-v8a.zip arm64-v8a/*so +zip -r sym-armeabi-v7a.zip armeabi-v7a/*so +zip -r sym-x86_64.zip x86_64/*so +popd +cp "${NATIVE_LIBS}/"*zip artifacts/