diff --git a/README.md b/README.md index 95a02850b3439813da01858d2bcd6ee6a7c5c4e7..db7cb3e0dea2bfd4f3a36f2c99de6ebf43d4b67c 100644 --- a/README.md +++ b/README.md @@ -132,6 +132,8 @@ Build `ipa` and `apk` using `production` configuration. Expamle configuration for Gitlab (`.gitlab-ci.yml`) ```yml +variables: + APP_DISTRIBUTOR_PROJECT_NAME: 'my_project' build_native: stage: production @@ -140,7 +142,7 @@ build_native: script: - echo "Building Native My App" - source $HOME/.bashrc - - rvm use 2.2.1 + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN docker.codevise.de - nvm use 9.2.0 - npm ci - cordova-build --build --ipa --apk ${CONFIG} @@ -156,14 +158,18 @@ build_js: script: - echo "Building My App" - source $HOME/.bashrc - - rvm use 2.2.1 + - docker login -u gitlab-ci-token -p $CI_BUILD_TOKEN docker.codevise.de - nvm use 9.2.0 - - bundle install - npm ci - cordova-build --sign --ipa --apk ${CONFIG} ``` +Required secret GitLab environment variables: + +* `APP_DISTRIBUTOR_SERVER_URL` +* `APP_DISTRIBUTOR_AUTH_TOKEN` + ## Dependencies * Cordova - * AppDistributor Gem + * Docker diff --git a/include/app_distributor.sh b/include/app_distributor.sh new file mode 100644 index 0000000000000000000000000000000000000000..980d554b7cb045ae276b6dad694839febc5132c3 --- /dev/null +++ b/include/app_distributor.sh @@ -0,0 +1,16 @@ +#!/bin/bash + +function appDistributor { + APP_DISTRIBUTOR_GEM_IMAGE=${APP_DISTRIBUTOR_GEM_IMAGE:-docker.codevise.de/codevise/app_distributor_gem:v0.2.0} + + docker run \ + -v $CORDOVA_PLATFORM_RELEASE_DIR:/platforms_release \ + -e APP_DISTRIBUTOR_SERVER_URL \ + -e APP_DISTRIBUTOR_AUTH_TOKEN \ + -e APP_DISTRIBUTOR_BUILD_NAME="${BUILD_NUMBER}_${CONFIG}_${BRANCH}" \ + -e APP_DISTRIBUTOR_PROJECT_NAME \ + -e APP_DISTRIBUTOR_APK_BUILD_DIR="/platforms_release/android/build/outputs/apk/" \ + -e APP_DISTRIBUTOR_IPA_BUILD_DIR="/platforms_release/ios/export/" \ + $APP_DISTRIBUTOR_GEM_IMAGE \ + "$1" +} diff --git a/include/index.sh b/include/index.sh index 26b42f23cd1a70f7a36f5d189950733ec6d58f36..83228666f5fe1db3221a9bac609018e3cc6290f0 100644 --- a/include/index.sh +++ b/include/index.sh @@ -5,3 +5,4 @@ source $INCLUDE_DIR/util.sh source $INCLUDE_DIR/env.sh source $INCLUDE_DIR/cache.sh source $INCLUDE_DIR/funcs.sh +source $INCLUDE_DIR/app_distributor.sh diff --git a/sign.sh b/sign.sh index 065f5dc7b48e0af804f180bd3ad25d2f097424d1..abb386157bf1935273687fe546c0953a2931dd99 100755 --- a/sign.sh +++ b/sign.sh @@ -44,7 +44,7 @@ if [ "$BUILD_IPA" == 'true' ]; then source $SHELLDIR/sign_ipa.sh echo_info "Submit IPA" - bundle exec rake app_distributor:submit:ipa + appDistributor submit:ipa fi if [ "$BUILD_APK" == 'true' ]; then @@ -53,6 +53,6 @@ if [ "$BUILD_APK" == 'true' ]; then source $SHELLDIR/sign_apk.sh echo_info "Submit APK" - bundle exec rake app_distributor:submit:apk + appDistributor submit:apk fi