2020-07-11 17:34:45 +02:00
|
|
|
stages:
|
|
|
|
- environment
|
|
|
|
- build
|
|
|
|
- test
|
|
|
|
- internal
|
|
|
|
- alpha
|
|
|
|
- beta
|
|
|
|
- production
|
|
|
|
- stop
|
|
|
|
|
2020-07-12 15:26:32 +02:00
|
|
|
.updateContainerJob:
|
|
|
|
image: docker:stable
|
|
|
|
stage: environment
|
|
|
|
services:
|
|
|
|
- docker:dind
|
|
|
|
script:
|
|
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
|
|
- docker pull $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG || true
|
|
|
|
- docker build --cache-from $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG -t $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG .
|
|
|
|
- docker push $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
2020-07-12 15:29:55 +02:00
|
|
|
tags:
|
2020-07-12 15:33:00 +02:00
|
|
|
- shell
|
2020-07-12 15:26:32 +02:00
|
|
|
|
|
|
|
updateContainer:
|
|
|
|
extends: .updateContainerJob
|
|
|
|
only:
|
|
|
|
changes:
|
|
|
|
- Dockerfile
|
|
|
|
|
|
|
|
ensureContainer:
|
|
|
|
extends: .updateContainerJob
|
|
|
|
allow_failure: true
|
|
|
|
before_script:
|
|
|
|
- "mkdir -p ~/.docker && echo '{\"experimental\": \"enabled\"}' > ~/.docker/config.json"
|
|
|
|
- docker login -u gitlab-ci-token -p $CI_JOB_TOKEN $CI_REGISTRY
|
|
|
|
# Skip update container `script` if the container already exists
|
|
|
|
# via https://gitlab.com/gitlab-org/gitlab-ce/issues/26866#note_97609397 -> https://stackoverflow.com/a/52077071/796832
|
|
|
|
- docker manifest inspect $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG > /dev/null && exit || true
|
2020-07-11 17:34:45 +02:00
|
|
|
|
|
|
|
.build_job:
|
2020-07-12 17:45:14 +02:00
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
2020-07-11 17:34:45 +02:00
|
|
|
stage: build
|
|
|
|
before_script:
|
|
|
|
# We store this binary file in a variable as hex with this command, `xxd -p thorium-android-app.jks`
|
|
|
|
# Then we convert the hex back to a binary file
|
2020-07-12 19:31:07 +02:00
|
|
|
- echo "$signing_jks_file_hex" | xxd -r -p - > android-signing-keystore.jks
|
2020-07-11 17:34:45 +02:00
|
|
|
# We add 1047 to get this high enough above current versionCodes that are published
|
|
|
|
- "export VERSION_CODE=$((1047 + $CI_PIPELINE_IID)) && echo $VERSION_CODE"
|
|
|
|
- "export VERSION_SHA=`echo ${CI_COMMIT_SHA:0:8}` && echo $VERSION_SHA"
|
|
|
|
# Move current version to a new release notes for fastlane
|
|
|
|
# This happens for every build, but only on master and tags this change gets submitted as an MR by `buildCreateReleaseNotes` task
|
2020-07-12 15:35:17 +02:00
|
|
|
# - mv ./fastlane/metadata/android/en-GB/changelogs/CURRENT_VERSION.txt "./fastlane/metadata/android/en-GB/changelogs/$VERSION_CODE.txt"
|
2020-07-11 17:34:45 +02:00
|
|
|
after_script:
|
2020-07-12 19:31:07 +02:00
|
|
|
- rm -f android-signing-keystore.jks || true
|
2020-07-11 17:34:45 +02:00
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- app/build/outputs
|
2020-07-12 15:05:24 +02:00
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
2020-07-11 17:34:45 +02:00
|
|
|
|
|
|
|
buildDebug:
|
|
|
|
extends: .build_job
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane buildDebug
|
|
|
|
|
|
|
|
#buildCreateReleaseNotes:
|
|
|
|
# extends: .build_job
|
|
|
|
# script:
|
|
|
|
# - ./ci-scripts/create-changelog-mr.sh
|
|
|
|
# only:
|
|
|
|
# - tags
|
|
|
|
|
|
|
|
buildRelease:
|
|
|
|
extends: .build_job
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane buildRelease
|
|
|
|
environment:
|
|
|
|
name: production
|
2020-07-12 20:38:48 +02:00
|
|
|
only:
|
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
|
|
|
except:
|
|
|
|
- branches
|
2020-07-11 17:34:45 +02:00
|
|
|
|
|
|
|
testDebug:
|
2020-07-12 17:45:14 +02:00
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
2020-07-11 17:34:45 +02:00
|
|
|
stage: test
|
|
|
|
dependencies:
|
|
|
|
- buildDebug
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane test
|
2020-07-12 20:51:03 +02:00
|
|
|
tags:
|
|
|
|
- docker
|
2020-07-11 17:34:45 +02:00
|
|
|
|
|
|
|
publishInternal:
|
2020-07-12 17:45:14 +02:00
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
2020-07-11 17:34:45 +02:00
|
|
|
stage: internal
|
|
|
|
dependencies:
|
|
|
|
- buildRelease
|
|
|
|
when: manual
|
|
|
|
before_script:
|
|
|
|
- echo $google_play_service_account_api_key_json > ~/google_play_api_key.json
|
|
|
|
after_script:
|
|
|
|
- rm -f ~/google_play_api_key.json
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane internal
|
|
|
|
|
|
|
|
.promote_job:
|
2020-07-12 17:45:14 +02:00
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
2020-07-11 17:34:45 +02:00
|
|
|
when: manual
|
|
|
|
dependencies: []
|
|
|
|
before_script:
|
|
|
|
- echo $google_play_service_account_api_key_json > ~/google_play_api_key.json
|
|
|
|
after_script:
|
|
|
|
- rm -f ~/google_play_api_key.json
|
|
|
|
|
|
|
|
promoteAlpha:
|
|
|
|
extends: .promote_job
|
|
|
|
stage: alpha
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane promote_internal_to_alpha
|
|
|
|
|
|
|
|
promoteBeta:
|
|
|
|
extends: .promote_job
|
|
|
|
stage: beta
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane promote_alpha_to_beta
|
|
|
|
|
|
|
|
promoteProduction:
|
|
|
|
extends: .promote_job
|
|
|
|
stage: production
|
|
|
|
# We only allow production promotion on `master` because
|
|
|
|
# it has its own production scoped secret variables
|
|
|
|
only:
|
|
|
|
- tags
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane promote_beta_to_production
|