# This is a sample build configuration for PHP.
# Check our guides at https://confluence.atlassian.com/x/e8YWN for more examples.
# Only use spaces to indent your .yml configuration.
# -----
# You can specify a custom docker image from Docker Hub as your build environment.
image:
  name: tjschneider/y-square:pipeline-env-2.0.0
  username: $YS_DOCKER_USER
  password: $YS_DOCKER_PASSWORD
  email: $YS_DOCKER_EMAIL

pipelines:
  tags:
    '1*':
      - step:
          name: Releasing
          caches:
            - node
          script:
            - cd $BITBUCKET_CLONE_DIR
            - chmod -R u+x build-scripts/* && build-scripts/build-oxid6.sh
  branches:
#    master:
#      - step:
#          name: Deploy to Staging
#          deployment: staging
#          script:
#            - apt-get update
#            - apt-get install -y openssh-client
#            - apt-get install -y rsync
#            - apt-get install -y python-sphinx python-setuptools
#            - apt-get install -y unzip
#            - apt-get install -y git
#            - apt-get update && apt-get install -y libfreetype6-dev libjpeg62-turbo-dev libpng-dev
#            - docker-php-ext-configure gd --with-freetype-dir=/usr/include/ --with-jpeg-dir=/usr/include/
#            - docker-php-ext-install -j$(nproc) gd
#            - docker-php-ext-install zip
#            - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#            - easy_install pip
#            - pip install sphinx_rtd_theme
#            - cd $BITBUCKET_CLONE_DIR
#            - chmod -R u+x build-scripts/* && build-scripts/build-oxid6.sh
#            - cd $BITBUCKET_CLONE_DIR/../release/oxid6/ysquare
#            - rsync -avzh -e ssh --ignore-times --delete UnifierCore ysqyhbyp@oxid.y-square.de:~/www.y-square.de/galaxus/staging/source/modules/ysquare/
#            - rsync -avzh -e ssh --ignore-times --delete UnifierOxid ysqyhbyp@oxid.y-square.de:~/www.y-square.de/galaxus/staging/source/modules/ysquare/

    develop:
      - step:
          name: Creating DEV Packages
          caches:
            - node
#          deployment: test
          script:
            - cd $BITBUCKET_CLONE_DIR
            - chmod -R u+x build-scripts/* && build-scripts/build-oxid6.sh

#  default:
#    - step:
#        caches:
#          - composer
#        script:
#          - apt-get update && apt-get install -y unzip
#          - curl -sS https://getcomposer.org/installer | php -- --install-dir=/usr/local/bin --filename=composer
#          - composer install
#          - vendor/bin/phpunit