diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index bfbbba567776381e98971839ef03bfd4f99cf4eb..142a372f00b54b5483b04e1c457ca455d6e87d98 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,15 @@ image: "registry.gitlab.e.foundation/e/os/docker-android-apps-cicd:latest" +variables: + APK_PATH: "app/build/outputs/apk/release" + UNSIGNED_APK: "app-release-unsigned.apk" + COMMUNITY_APK: "Notes_community.apk" + OFFICIAL_APK: "Notes_official.apk" + stages: - update-from-upstream - build + - gitlab_release before_script: - export GRADLE_USER_HOME=$(pwd)/.gradle @@ -77,4 +84,78 @@ update-default-branch: UPSTREAM_BRANCH: upstream/master UPSTREAM_DEFAULT_BRANCH: main UPSTREAM_URL: https://github.com/nextcloud/notes-android.git - TEMP_LATEST_TAG_BRANCH: latest_upstream_tag_branch \ No newline at end of file + TEMP_LATEST_TAG_BRANCH: latest_upstream_tag_branch + +init_submodules: + stage: gitlab_release + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success + script: + - git clone https://gitlab.e.foundation/e/os/system-apps-update-info.git systemAppsUpdateInfo + artifacts: + paths: + - systemAppsUpdateInfo/scripts/ + +generate-apks: + stage: gitlab_release + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success + needs: + - init_submodules + - build + dependencies: + - init_submodules + - build + before_script: + - apt update && apt install apksigner -y + script: + - | + ./systemAppsUpdateInfo/scripts/generate-apks.sh \ + "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" + artifacts: + paths: + - $APK_PATH/$UNSIGNED_APK + - $APK_PATH/$COMMUNITY_APK + - $APK_PATH/$OFFICIAL_APK + +create-json-files: + stage: gitlab_release + dependencies: + - init_submodules + - generate-apks + needs: + - init_submodules + - generate-apks + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: manual + before_script: + - apt update && apt install jq aapt -y + script: + - | + ./systemAppsUpdateInfo/scripts/create-json-files.sh \ + "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" + artifacts: + paths: + - community.json + - official.json + +create-release: + stage: gitlab_release + dependencies: + - init_submodules + needs: + - init_submodules + - create-json-files + - generate-apks + rules: + - if: '$CI_COMMIT_TAG && $CI_COMMIT_REF_PROTECTED == "true"' + when: on_success + before_script: + - apt update && apt install jq -y + script: + - | + ./systemAppsUpdateInfo/scripts/create-release.sh \ + "$APK_PATH" "$UNSIGNED_APK" "$COMMUNITY_APK" "$OFFICIAL_APK" diff --git a/app/build.gradle b/app/build.gradle index bc596c3b16f9a59921d0805c91c63442b2006a8c..6e816b9e82b9f1e86dd931a46c9357a4bf367579 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,9 @@ apply plugin: 'com.android.application' +def buildDate = { -> + return new Date().format('yyyyMMddHHmmss') +} + android { compileSdkVersion 33 buildToolsVersion '31.0.0' @@ -36,6 +40,7 @@ android { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' + versionNameSuffix "-${buildDate()}" } }