Add Android App Bundle build and upload

Up upload-artifact action to version 4
This commit is contained in:
albexk 2024-01-17 21:24:42 +03:00
parent 78420d617b
commit ad21d7ab64
2 changed files with 46 additions and 21 deletions

View file

@ -49,13 +49,13 @@ jobs:
bash deploy/build_linux.sh bash deploy/build_linux.sh
- name: 'Upload installer artifact' - name: 'Upload installer artifact'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN_Linux_installer name: AmneziaVPN_Linux_installer
path: deploy/AmneziaVPN_Linux_Installer path: deploy/AmneziaVPN_Linux_Installer
retention-days: 7 retention-days: 7
- name: 'Upload unpacked artifact' - name: 'Upload unpacked artifact'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN_Linux_unpacked name: AmneziaVPN_Linux_unpacked
path: deploy/AppDir path: deploy/AppDir
@ -110,13 +110,13 @@ jobs:
call deploy\\build_windows.bat call deploy\\build_windows.bat
- name: 'Upload installer artifact' - name: 'Upload installer artifact'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN_Windows_installer name: AmneziaVPN_Windows_installer
path: AmneziaVPN_x${{ env.BUILD_ARCH }}.exe path: AmneziaVPN_x${{ env.BUILD_ARCH }}.exe
retention-days: 7 retention-days: 7
- name: 'Upload unpacked artifact' - name: 'Upload unpacked artifact'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN_Windows_unpacked name: AmneziaVPN_Windows_unpacked
path: deploy\\build_${{ env.BUILD_ARCH }}\\client\\Release path: deploy\\build_${{ env.BUILD_ARCH }}\\client\\Release
@ -200,7 +200,7 @@ jobs:
IOS_NE_PROVISIONING_PROFILE: ${{ secrets.IOS_NE_PROVISIONING_PROFILE }} IOS_NE_PROVISIONING_PROFILE: ${{ secrets.IOS_NE_PROVISIONING_PROFILE }}
# - name: 'Upload appstore .ipa and dSYMs to artifacts' # - name: 'Upload appstore .ipa and dSYMs to artifacts'
# uses: actions/upload-artifact@v3 # uses: actions/upload-artifact@v4
# with: # with:
# name: app-store ipa & dsyms # name: app-store ipa & dsyms
# path: | # path: |
@ -255,13 +255,13 @@ jobs:
bash deploy/build_macos.sh bash deploy/build_macos.sh
- name: 'Upload installer artifact' - name: 'Upload installer artifact'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN_MacOS_installer name: AmneziaVPN_MacOS_installer
path: AmneziaVPN.dmg path: AmneziaVPN.dmg
retention-days: 7 retention-days: 7
- name: 'Upload unpacked artifact' - name: 'Upload unpacked artifact'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN_MacOS_unpacked name: AmneziaVPN_MacOS_unpacked
path: deploy/build/client/AmneziaVPN.app path: deploy/build/client/AmneziaVPN.app
@ -277,6 +277,7 @@ jobs:
ANDROID_BUILD_PLATFORM: android-34 ANDROID_BUILD_PLATFORM: android-34
QT_VERSION: 6.6.1 QT_VERSION: 6.6.1
QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools' QT_MODULES: 'qtremoteobjects qt5compat qtimageformats qtshadertools'
BUILD_AAB: ${{ github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/') }}
steps: steps:
- name: 'Install desktop Qt' - name: 'Install desktop Qt'
@ -375,32 +376,45 @@ jobs:
ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }} ANDROID_KEYSTORE_KEY_ALIAS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_ALIAS }}
ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }} ANDROID_KEYSTORE_KEY_PASS: ${{ secrets.ANDROID_RELEASE_KEYSTORE_KEY_PASS }}
shell: bash shell: bash
run: ./deploy/build_android.sh --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }} run: ./deploy/build_android.sh ${{ env.BUILD_AAB == 'true' && '--aab' || '' }} --apk all --build-platform ${{ env.ANDROID_BUILD_PLATFORM }}
- name: 'Upload x86_64 apk' - name: 'Upload x86_64 apk'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN-android-x86_64 name: AmneziaVPN-android-x86_64
path: deploy/build/AmneziaVPN-x86_64-release.apk path: deploy/build/AmneziaVPN-x86_64-release.apk
compression-level: 0
retention-days: 7 retention-days: 7
- name: 'Upload x86 apk' - name: 'Upload x86 apk'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN-android-x86 name: AmneziaVPN-android-x86
path: deploy/build/AmneziaVPN-x86-release.apk path: deploy/build/AmneziaVPN-x86-release.apk
compression-level: 0
retention-days: 7 retention-days: 7
- name: 'Upload arm64-v8a apk' - name: 'Upload arm64-v8a apk'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN-android-arm64-v8a name: AmneziaVPN-android-arm64-v8a
path: deploy/build/AmneziaVPN-arm64-v8a-release.apk path: deploy/build/AmneziaVPN-arm64-v8a-release.apk
compression-level: 0
retention-days: 7 retention-days: 7
- name: 'Upload armeabi-v7a apk' - name: 'Upload armeabi-v7a apk'
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v4
with: with:
name: AmneziaVPN-android-armeabi-v7a name: AmneziaVPN-android-armeabi-v7a
path: deploy/build/AmneziaVPN-armeabi-v7a-release.apk path: deploy/build/AmneziaVPN-armeabi-v7a-release.apk
compression-level: 0
retention-days: 7
- name: 'Upload aab'
if: ${{ env.BUILD_AAB == 'true' }}
uses: actions/upload-artifact@v4
with:
name: AmneziaVPN-android
path: deploy/build/AmneziaVPN-release.aab
compression-level: 0
retention-days: 7 retention-days: 7

View file

@ -7,15 +7,18 @@ usage() {
cat <<EOT cat <<EOT
Usage: Usage:
build_android [options] build_android [options] <artifact_types>
Build AmneziaVPN android client. By default, a signed Android App Bundle (AAB) is built. Build AmneziaVPN android client.
Options: Artifact types:
-d, --debug Build debug version -u, --aab Build Android App Bundle (AAB)
-a, --apk (<abi_list> | all) Build APKs for the specified ABIs or for all available ABIs -a, --apk (<abi_list> | all) Build APKs for the specified ABIs or for all available ABIs
Available ABIs: 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a' Available ABIs: 'x86', 'x86_64', 'armeabi-v7a', 'arm64-v8a'
<abi_list> - list of ABIs delimited by ';' <abi_list> - list of ABIs delimited by ';'
Options:
-d, --debug Build debug version
-b, --build-platform <platform> The SDK platform used for building the Java code of the application -b, --build-platform <platform> The SDK platform used for building the Java code of the application
By default, the latest available platform is used By default, the latest available platform is used
-m, --move Move the build result to the root of the build directory -m, --move Move the build result to the root of the build directory
@ -25,14 +28,14 @@ EOT
} }
BUILD_TYPE="release" BUILD_TYPE="release"
AAB=1
opts=$(getopt -l debug,apk:,build-platform:,move,help -o "da:b:mh" -- "$@") opts=$(getopt -l debug,aab,apk:,build-platform:,move,help -o "dua:b:mh" -- "$@")
eval set -- "$opts" eval set -- "$opts"
while true; do while true; do
case "$1" in case "$1" in
-d | --debug) BUILD_TYPE="debug"; shift;; -d | --debug) BUILD_TYPE="debug"; shift;;
-a | --apk) ABIS=$2; unset AAB; shift 2;; -u | --aab) AAB=1; shift;;
-a | --apk) ABIS=$2; shift 2;;
-b | --build-platform) ANDROID_BUILD_PLATFORM=$2; shift 2;; -b | --build-platform) ANDROID_BUILD_PLATFORM=$2; shift 2;;
-m | --move) MOVE_RESULT=1; shift;; -m | --move) MOVE_RESULT=1; shift;;
-h | --help) usage; exit 0;; -h | --help) usage; exit 0;;
@ -49,6 +52,11 @@ if [[ -v ABIS && \
exit 1 exit 1
fi fi
# At least one artifact type must be specified
if [[ ! (-v AAB || -v ABIS) ]]; then
usage; exit 0
fi
echo "Build script started..." echo "Build script started..."
PROJECT_DIR=$(pwd) PROJECT_DIR=$(pwd)
@ -137,7 +145,8 @@ gradle_opts=()
if [ -v AAB ]; then if [ -v AAB ]; then
gradle_opts+=(bundle"${BUILD_TYPE^}") gradle_opts+=(bundle"${BUILD_TYPE^}")
else fi
if [ -v ABIS ]; then
gradle_opts+=(assemble"${BUILD_TYPE^}") gradle_opts+=(assemble"${BUILD_TYPE^}")
fi fi
@ -151,7 +160,9 @@ if [[ -v CI || -v MOVE_RESULT ]]; then
if [ -v AAB ]; then if [ -v AAB ]; then
mv -u $OUT_APP_DIR/android-build/build/outputs/bundle/$BUILD_TYPE/AmneziaVPN-$BUILD_TYPE.aab \ mv -u $OUT_APP_DIR/android-build/build/outputs/bundle/$BUILD_TYPE/AmneziaVPN-$BUILD_TYPE.aab \
$PROJECT_DIR/deploy/build/ $PROJECT_DIR/deploy/build/
else fi
if [ -v ABIS ]; then
if [ "$ABIS" = "all" ]; then if [ "$ABIS" = "all" ]; then
ABIS="x86;x86_64;armeabi-v7a;arm64-v8a" ABIS="x86;x86_64;armeabi-v7a;arm64-v8a"
fi fi