2020-08-29 22:33:23 +02:00
|
|
|
stages:
|
|
|
|
- environment
|
2021-01-31 23:35:16 +01:00
|
|
|
- fetch-version
|
2020-08-29 22:33:23 +02:00
|
|
|
- build
|
|
|
|
- test
|
2021-01-31 23:35:16 +01:00
|
|
|
- release
|
2020-08-29 22:33:23 +02:00
|
|
|
- internal
|
|
|
|
- alpha
|
|
|
|
- beta
|
|
|
|
- production
|
|
|
|
|
|
|
|
.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
|
|
|
|
tags:
|
|
|
|
- shell
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
.build_job:
|
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
stage: build
|
|
|
|
before_script:
|
|
|
|
# We store this binary file in a variable as hex with this command, `xxd -p android-signing-keystore.jks > jks.txt` (remove all \n)
|
|
|
|
# Then we convert the hex back to a binary file
|
|
|
|
- pwd
|
|
|
|
- echo "$signing_jks_file_hex" | xxd -r -p - > android-signing-keystore.jks
|
|
|
|
- md5sum android-signing-keystore.jks
|
|
|
|
after_script:
|
|
|
|
- rm -f android-signing-keystore.jks || true
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- app/build/outputs
|
2021-01-31 23:35:16 +01:00
|
|
|
- app/build.gradle
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
# https://levelup.gitconnected.com/semantic-versioning-and-release-automation-on-gitlab-9ba16af0c21
|
|
|
|
fetch-semantic-version:
|
2021-10-04 22:08:19 +02:00
|
|
|
image: node:14
|
2021-01-31 23:35:16 +01:00
|
|
|
stage: fetch-version
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- master
|
|
|
|
- alpha
|
|
|
|
- /^(([0-9]+)\.)?([0-9]+)\.x/ # This matches maintenance branches
|
|
|
|
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ # This matches pre-releases
|
|
|
|
script:
|
|
|
|
- npm install @semantic-release/gitlab @semantic-release/exec @semantic-release/changelog @semantic-release/git -D
|
|
|
|
- npx semantic-release --generate-notes false --dry-run
|
|
|
|
- export VERSION_CODE=`grep -oP "versionCode[\s]*(\d)+" app/build.gradle | awk '{ print $2 }'`
|
|
|
|
- export VERSION_CODE=$((${VERSION_CODE}+1)) && echo ${VERSION_CODE}
|
|
|
|
- export VERSION_SHA=`echo ${CI_COMMIT_SHA:0:8}` && echo ${VERSION_SHA}
|
|
|
|
- export VERSION=`cat VERSION.txt` && echo ${VERSION}
|
2021-02-05 15:55:01 +01:00
|
|
|
- export VERSION_NAME=${VERSION} && echo ${VERSION_NAME}
|
2021-01-31 23:35:16 +01:00
|
|
|
- sed -i -e "s/versionCode .*/versionCode ${VERSION_CODE}/g" app/build.gradle
|
|
|
|
- sed -i -e "s/versionName .*/versionName \"${VERSION_NAME}\"/g" app/build.gradle
|
|
|
|
- echo ${VERSION_CODE} > VERSION_CODE.txt
|
|
|
|
- echo ${VERSION_NAME} > VERSION_NAME.txt
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- VERSION.txt
|
|
|
|
- VERSION_CODE.txt
|
|
|
|
- VERSION_NAME.txt
|
|
|
|
- app/build.gradle
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
generate-non-semantic-version:
|
|
|
|
stage: fetch-version
|
|
|
|
except:
|
|
|
|
refs:
|
|
|
|
- master
|
|
|
|
- alpha
|
|
|
|
- /^(([0-9]+)\.)?([0-9]+)\.x/ # This matches maintenance branches
|
|
|
|
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/ # This matches pre-releases
|
|
|
|
script:
|
|
|
|
- echo build-$CI_PIPELINE_ID > VERSION.txt
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- VERSION.txt
|
2020-08-29 22:33:23 +02:00
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
|
|
|
buildDebug:
|
|
|
|
extends: .build_job
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane buildDebug
|
|
|
|
|
2021-01-31 23:35:16 +01:00
|
|
|
testDebug:
|
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
stage: test
|
|
|
|
dependencies:
|
|
|
|
- buildDebug
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane test
|
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
|
2020-08-29 22:33:23 +02:00
|
|
|
buildRelease:
|
|
|
|
extends: .build_job
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane buildRelease
|
|
|
|
environment:
|
|
|
|
name: production
|
|
|
|
only:
|
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
|
|
|
except:
|
|
|
|
- branches
|
|
|
|
|
2021-01-31 23:35:16 +01:00
|
|
|
release:
|
2021-10-05 21:58:09 +02:00
|
|
|
image: node:14
|
2021-01-31 23:35:16 +01:00
|
|
|
stage: release
|
|
|
|
only:
|
|
|
|
refs:
|
|
|
|
- master
|
|
|
|
- alpha
|
|
|
|
# This matches maintenance branches
|
|
|
|
- /^(([0-9]+)\.)?([0-9]+)\.x/
|
|
|
|
# This matches pre-releases
|
|
|
|
- /^([0-9]+)\.([0-9]+)\.([0-9]+)(?:-([0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*))?(?:\+[0-9A-Za-z-]+)?$/
|
2020-08-29 22:33:23 +02:00
|
|
|
script:
|
2021-01-31 23:35:16 +01:00
|
|
|
- npm install @semantic-release/gitlab @semantic-release/exec @semantic-release/changelog @semantic-release/git -D
|
|
|
|
- npx semantic-release
|
|
|
|
artifacts:
|
|
|
|
paths:
|
|
|
|
- CHANGELOG.md
|
2020-08-29 22:33:23 +02:00
|
|
|
tags:
|
|
|
|
- docker
|
2021-01-31 23:35:16 +01:00
|
|
|
|
|
|
|
publishInternal:
|
2020-08-29 22:33:23 +02:00
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
stage: internal
|
|
|
|
dependencies:
|
|
|
|
- buildRelease
|
|
|
|
when: manual
|
2021-01-31 23:35:16 +01:00
|
|
|
before_script:
|
|
|
|
- echo $google_play_service_account_api_key_json > ../google_play_api_key.json
|
|
|
|
- md5sum /builds/sschueller/google_play_api_key.json
|
|
|
|
after_script:
|
|
|
|
- rm -f ../google_play_api_key.json
|
2020-08-29 22:33:23 +02:00
|
|
|
script:
|
2021-01-31 23:35:16 +01:00
|
|
|
- bundle exec fastlane internal
|
2020-08-29 22:33:23 +02:00
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
only:
|
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
|
|
|
|
2021-01-31 23:35:16 +01:00
|
|
|
publishGithub:
|
2020-08-29 22:33:23 +02:00
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
stage: internal
|
|
|
|
dependencies:
|
|
|
|
- buildRelease
|
|
|
|
when: manual
|
|
|
|
script:
|
2021-01-31 23:35:16 +01:00
|
|
|
- export VERSION_CODE=`cat VERSION_CODE.txt`
|
|
|
|
- export VERSION_NAME=`cat VERSION_NAME.txt`
|
|
|
|
- ci-scripts/make-github-release.sh
|
2020-08-29 22:33:23 +02:00
|
|
|
tags:
|
|
|
|
- docker
|
|
|
|
only:
|
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
|
|
|
|
|
|
|
.promote_job:
|
|
|
|
image: $CI_REGISTRY_IMAGE:$CI_COMMIT_REF_SLUG
|
|
|
|
when: manual
|
|
|
|
dependencies: []
|
|
|
|
before_script:
|
|
|
|
- echo $google_play_service_account_api_key_json > ../google_play_api_key.json
|
|
|
|
- md5sum ../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
|
|
|
|
tags:
|
|
|
|
- docker
|
2020-08-30 14:28:26 +02:00
|
|
|
only:
|
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
2020-08-29 22:33:23 +02:00
|
|
|
|
|
|
|
promoteBeta:
|
|
|
|
extends: .promote_job
|
|
|
|
stage: beta
|
|
|
|
script:
|
|
|
|
- bundle exec fastlane promote_alpha_to_beta
|
|
|
|
tags:
|
|
|
|
- docker
|
2020-08-30 14:28:26 +02:00
|
|
|
only:
|
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
2020-08-29 22:33:23 +02:00
|
|
|
|
|
|
|
promoteProduction:
|
|
|
|
extends: .promote_job
|
|
|
|
stage: production
|
|
|
|
# We only allow production promotion on `master` because
|
|
|
|
# it has its own production scoped secret variables
|
|
|
|
only:
|
2020-08-30 14:28:26 +02:00
|
|
|
- /^v[0-9]*\.[0-9]*\.[0-9]*$/i
|
2020-08-29 22:33:23 +02:00
|
|
|
script:
|
|
|
|
- bundle exec fastlane promote_beta_to_production
|
|
|
|
tags:
|
2021-01-31 23:35:16 +01:00
|
|
|
- docker
|