I have on my git repo two basic branches; master und develop
They have 2 Task, tests and deploy_for_development
image: php:7.2
stages:
- test
- deploy_development
run_tests:
stage: test
script:
- apt-get update -yqq
- apt-get install -yqq
- php -r "copy('https://getcomposer.org/installer', 'composer-setup.php');"
- php composer-setup.php
- mv composer.phar /usr/local/bin/composer
- composer install
- curl --location --output /usr/local/bin/phpunit https://phar.phpunit.de/phpunit.phar
- chmod +x /usr/local/bin/phpunit
- phpunit
deploy_for_development:
stage: deploy_development
script:
- apt-get update -yqq
- apt-get install -yqq
- apt-get install -y -qq lftp
- lftp -c "set ftp:ssl-allow no; open -u $DEV_USERNAME,$DEV_PASSWORD $DEV_HOST; mirror -Rnev ./ ./your/ftp/path/ --ignore-time --parallel=10 --exclude-glob .git* --exclude .git/"
only:
- develop
This $DEV_USERNAME,$DEV_PASSWORD $DEV_HOST variables saved under GitLab CE -> Repo -> CI/CD Settings, like this.
Views: 384