.gitlab-ci.yml 1.05 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34
cache:
  key: "$CI_BUILD_NAME/$CI_BUILD_REF_NAME"
  untracked: true
  paths:
    - cache/

stages:
  - build
  - upload


# TER Upload when tagging in master branch
# The variables T3O_USERNAME and T3O_PASSWORD should be set in GitLab
ter-upload:
  stage: upload
  only:
    - tags
  before_script:
    - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
    - export COMPOSER_CACHE_DIR=/cache/composer
  script:
    - composer install
    - composer require namelesscoder/typo3-repository-client
    - export TYPO3_PATH_WEB="$PWD/.Build/Web"
    - >
      if [ -n "$CI_BUILD_TAG" ] && [ -n "$T3O_USERNAME" ] && [ -n "$T3O_PASSWORD" ]; then
        echo -e "Preparing upload of release ${CI_BUILD_TAG} to TER\n"
        # Cleanup before we upload
        git reset --hard HEAD && git clean -fx
        # Upload
        TAG_MESSAGE=`git tag -n10 -l $CI_BUILD_TAG | sed 's/^[0-9.]*[ ]*//g'`
        echo "Uploading release ${CI_BUILD_TAG} to TER"
        .Build/bin/upload . "$T3O_USERNAME" "$T3O_PASSWORD" "$TAG_MESSAGE"
      fi;