Skip to content
Snippets Groups Projects
Commit ccf8682d authored by Benoît Harrault's avatar Benoît Harrault
Browse files

Add automatic tag creation on release CI step

parent a15bfa3a
No related branches found
No related tags found
No related merge requests found
Pipeline #1439 failed
image: cirrusci/flutter:latest image: cirrusci/flutter:latest
stages: stages:
- test # - update
- update
- build-debug - build-debug
- build-release - build-release
- release
- deploy - deploy
tests: # update:
stage: test # stage: update
script: # script:
- flutter test # - flutter packages get
interruptible: true # - flutter packages upgrade
# interruptible: true
update:
stage: update
script:
- flutter packages get
- flutter packages upgrade
interruptible: true
android:build-debug: android:build-debug:
stage: build-debug stage: build-debug
script: script:
# Flutter local configuration # # Flutter local configuration
- echo flutter.sdk=$FLUTTER_PATH > android/local.properties # - echo flutter.sdk=$FLUTTER_PATH > android/local.properties
- echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties # - echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties
- echo flutter.buildMode=debug >> android/local.properties # - echo flutter.buildMode=debug >> android/local.properties
# Android signing # # Android signing
- echo "$ANDROID_DEBUG_KEYSTORE_FILE" | base64 -d > android/app/my.keystore # - echo "$ANDROID_DEBUG_KEYSTORE_FILE" | base64 -d > android/app/my.keystore
- echo storeFile=my.keystore > android/key.properties # - echo storeFile=my.keystore > android/key.properties
- echo storePassword=$ANDROID_DEBUG_KEYSTORE_PASSWORD >> android/key.properties # - echo storePassword=$ANDROID_DEBUG_KEYSTORE_PASSWORD >> android/key.properties
- echo keyAlias=$ANDROID_DEBUG_KEY_ALIAS >> android/key.properties # - echo keyAlias=$ANDROID_DEBUG_KEY_ALIAS >> android/key.properties
- echo keyPassword=$ANDROID_DEBUG_KEY_PASSWORD >> android/key.properties # - echo keyPassword=$ANDROID_DEBUG_KEY_PASSWORD >> android/key.properties
# build flutter app # # build flutter app
- flutter packages get # - flutter packages get
- flutter clean # - flutter clean
- flutter build apk --debug # - flutter build apk --debug
# prepare artifact # # prepare artifact
- find . -name "*.apk" # where is my apk? - find . -name "*.apk" # where is my apk?
artifacts: # artifacts:
paths: # paths:
- build/app/outputs/apk/debug # - build/app/outputs/apk/debug
expire_in: 1 week # expire_in: 1 week
interruptible: true # interruptible: true
android:build-release: android:build-release:
stage: build-release stage: build-release
only: # only:
- master # - master
dependencies: dependencies:
- android:build-debug - android:build-debug
script: script:
# Flutter local configuration # # Flutter local configuration
- echo flutter.sdk=$FLUTTER_PATH > android/local.properties # - echo flutter.sdk=$FLUTTER_PATH > android/local.properties
- echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties # - echo sdk.dir=$ANDROID_SDK_PATH >> android/local.properties
- echo flutter.buildMode=release >> android/local.properties # - echo flutter.buildMode=release >> android/local.properties
# Android signing # # Android signing
- echo "$ANDROID_KEYSTORE_FILE" | base64 -d > android/app/my.keystore # - echo "$ANDROID_KEYSTORE_FILE" | base64 -d > android/app/my.keystore
- echo storeFile=my.keystore > android/key.properties # - echo storeFile=my.keystore > android/key.properties
- echo storePassword=$ANDROID_KEYSTORE_PASSWORD >> android/key.properties # - echo storePassword=$ANDROID_KEYSTORE_PASSWORD >> android/key.properties
- echo keyAlias=$ANDROID_KEY_ALIAS >> android/key.properties # - echo keyAlias=$ANDROID_KEY_ALIAS >> android/key.properties
- echo keyPassword=$ANDROID_KEY_PASSWORD >> android/key.properties # - echo keyPassword=$ANDROID_KEY_PASSWORD >> android/key.properties
# build flutter app # # build flutter app
- flutter packages get # - flutter packages get
- flutter clean # - flutter clean
- flutter build apk --release # - flutter build apk --release
# prepare artifact # # prepare artifact
- find . -name "*.apk" # where is my apk? - find . -name "*.apk" # where is my apk?
artifacts: # artifacts:
paths: # paths:
- build/app/outputs/apk/release # - build/app/outputs/apk/release
expire_in: 1 week # expire_in: 1 week
interruptible: true # 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: android:deploy:
stage: deploy stage: deploy
only: only:
- master - tags
dependencies: dependencies:
- android:build-release - application:release
script: script:
- wget ${REPOSITORY_UPDATE_WEBHOOK}?token=${REPOSITORY_TOKEN} - wget ${REPOSITORY_UPDATE_WEBHOOK}?token=${REPOSITORY_TOKEN}
org.gradle.jvmargs=-Xmx1536M org.gradle.jvmargs=-Xmx1536M
android.useAndroidX=true android.useAndroidX=true
android.enableJetifier=true android.enableJetifier=true
app.versionName=1.0.1 app.versionName=1.0.2
app.versionCode=2 app.versionCode=3
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment