diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 77543d5f4ba3852fa0a4fc15701e1f4864133a8d..1c7d39448c94ba1e00d9a1279e4582d4f97f42d3 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,84 +1,99 @@ image: cirrusci/flutter:latest stages: - - test - - update + # - update - build-debug - build-release + - release - deploy -tests: - stage: test - script: - - flutter test - interruptible: true - -update: - stage: update - script: - - flutter packages get - - flutter packages upgrade - interruptible: true +# update: +# stage: update +# script: +# - flutter packages get +# - flutter packages upgrade +# interruptible: true android:build-debug: stage: build-debug script: - # Flutter local configuration - - echo flutter.sdk=$FLUTTER_PATH > android/local.properties - - echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties - - echo flutter.buildMode=debug >> android/local.properties - # Android signing - - echo "$ANDROID_DEBUG_KEYSTORE_FILE" | base64 -d > android/app/my.keystore - - echo storeFile=my.keystore > android/key.properties - - echo storePassword=$ANDROID_DEBUG_KEYSTORE_PASSWORD >> android/key.properties - - echo keyAlias=$ANDROID_DEBUG_KEY_ALIAS >> android/key.properties - - echo keyPassword=$ANDROID_DEBUG_KEY_PASSWORD >> android/key.properties - # build flutter app - - flutter packages get - - flutter clean - - flutter build apk --debug - # prepare artifact + # # Flutter local configuration + # - echo flutter.sdk=$FLUTTER_PATH > android/local.properties + # - echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties + # - echo flutter.buildMode=debug >> android/local.properties + # # Android signing + # - echo "$ANDROID_DEBUG_KEYSTORE_FILE" | base64 -d > android/app/my.keystore + # - echo storeFile=my.keystore > android/key.properties + # - echo storePassword=$ANDROID_DEBUG_KEYSTORE_PASSWORD >> android/key.properties + # - echo keyAlias=$ANDROID_DEBUG_KEY_ALIAS >> android/key.properties + # - echo keyPassword=$ANDROID_DEBUG_KEY_PASSWORD >> android/key.properties + # # build flutter app + # - flutter packages get + # - flutter clean + # - flutter build apk --debug + # # prepare artifact - find . -name "*.apk" # where is my apk? - artifacts: - paths: - - build/app/outputs/apk/debug - expire_in: 1 week - interruptible: true + # artifacts: + # paths: + # - build/app/outputs/apk/debug + # expire_in: 1 week + # interruptible: true android:build-release: stage: build-release - only: - - master + # only: + # - master dependencies: - android:build-debug script: - # Flutter local configuration - - echo flutter.sdk=$FLUTTER_PATH > android/local.properties - - echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties - - echo flutter.buildMode=release >> android/local.properties - # Android signing - - echo "$ANDROID_KEYSTORE_FILE" | base64 -d > android/app/my.keystore - - echo storeFile=my.keystore > android/key.properties - - echo storePassword=$ANDROID_KEYSTORE_PASSWORD >> android/key.properties - - echo keyAlias=$ANDROID_KEY_ALIAS >> android/key.properties - - echo keyPassword=$ANDROID_KEY_PASSWORD >> android/key.properties - # build flutter app - - flutter packages get - - flutter clean - - flutter build apk --release - # prepare artifact + # # Flutter local configuration + # - echo flutter.sdk=$FLUTTER_PATH > android/local.properties + # - echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties + # - echo flutter.buildMode=release >> android/local.properties + # # Android signing + # - echo "$ANDROID_KEYSTORE_FILE" | base64 -d > android/app/my.keystore + # - echo storeFile=my.keystore > android/key.properties + # - echo storePassword=$ANDROID_KEYSTORE_PASSWORD >> android/key.properties + # - echo keyAlias=$ANDROID_KEY_ALIAS >> android/key.properties + # - echo keyPassword=$ANDROID_KEY_PASSWORD >> android/key.properties + # # build flutter app + # - flutter packages get + # - flutter clean + # - flutter build apk --release + # # prepare artifact - find . -name "*.apk" # where is my apk? - artifacts: - paths: - - build/app/outputs/apk/release - expire_in: 1 week - interruptible: true + # artifacts: + # paths: + # - build/app/outputs/apk/release + # expire_in: 1 week + # interruptible: true + +application:release: + stage: release + image: + name: alpine/git + entrypoint: [""] + # only: + # - master + dependencies: + - android:build-release + script: + - git config user.email "${GITLAB_USER_EMAIL}" + - git config user.name "${GITLAB_USER_NAME}" + - git remote set-url origin https://oauth2:${GITLAB_ACCESS_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH} + - VERSION_FILE="$(find . -name 'gradle.properties' | head -n1)" + - VERSION_NAME="$(grep '^app.versionName=' "${VERSION_FILE}" | cut -d'=' -f2)" + - VERSION_CODE="$(grep '^app.versionCode=' "${VERSION_FILE}" | cut -d'=' -f2)" + - TAG_NAME="Release_${VERSION_CODE}_${VERSION_NAME}" + - echo "${TAG_NAME}" + - git tag -a "Release_${TAG_NAME}" -m "Auto-Release ${VERSION_NAME} (${VERSION_CODE})" + - git push origin "Release_${TAG_NAME}" android:deploy: stage: deploy only: - - master + - tags dependencies: - - android:build-release + - application:release script: - wget ${REPOSITORY_UPDATE_WEBHOOK}?token=${REPOSITORY_TOKEN} diff --git a/android/gradle.properties b/android/gradle.properties index 379a5b70bc7d025bf005014c5ab18b682895abc4..05f2f47d659639286844e03e2a00088c5fc37922 100644 --- a/android/gradle.properties +++ b/android/gradle.properties @@ -1,5 +1,5 @@ org.gradle.jvmargs=-Xmx1536M android.useAndroidX=true android.enableJetifier=true -app.versionName=1.0.1 -app.versionCode=2 +app.versionName=1.0.2 +app.versionCode=3