adding deploy to packagist into pipeline

This commit is contained in:
Julien Fastré 2016-11-20 22:21:44 +01:00
parent 9f3cdfdff8
commit f37f78f3a8

View File

@ -1,17 +1,32 @@
services: .test_definition: &test_definition
- chill/database:latest services:
- chill/database:latest
before_script:
- composer config github-oauth.github.com $GITHUB_TOKEN before_script:
- composer install --no-interaction - composer config github-oauth.github.com $GITHUB_TOKEN
- cp Test/Fixtures/App/app/config/parameters.gitlab-ci.yml Test/Fixtures/App/app/config/parameters.yml - composer install --no-interaction
# - php Test/Fixtures/App/app/console --env=test cache:warmup - cp Test/Fixtures/App/app/config/parameters.gitlab-ci.yml Test/Fixtures/App/app/config/parameters.yml
- php Test/Fixtures/App/app/console doctrine:migrations:migrate --env=test --no-interaction # - php Test/Fixtures/App/app/console --env=test cache:warmup
- php Test/Fixtures/App/app/console doctrine:fixtures:load --env=test --no-interaction - php Test/Fixtures/App/app/console doctrine:migrations:migrate --env=test --no-interaction
- php Test/Fixtures/App/app/console doctrine:fixtures:load --env=test --no-interaction
test:php-5.6: test:php-5.6:
stage: test stage: test
<<: *test_definition
script: phpunit script: phpunit
test:php-7: test:php-7:
stage: test stage: test
script: phpunit <<: *test_definition
script: phpunit
deploy-packagist:
stage: deploy
image: chill/ci-image:php-7
before_script:
# test that PACKAGIST USERNAME and PACKAGIST_TOKEN variable are set
- if [ -z ${PACKAGIST_USERNAME+x} ]; then echo "Please set PACKAGIST_USERNAME variable"; exit -1; fi
- if [ -z ${PACKAGIST_TOKEN+x} ]; then echo "Please set PACKAGIST_TOKEN variable"; exit -1; fi
script:
- STATUSCODE=$(curl -XPOST -H'content-type:application/json' "https://packagist.org/api/update-package?username=$PACKAGIST_USERNAME&apiToken=$PACKAGIST_TOKEN" -d"{\"repository\":{\"url\":\"$CI_PROJECT_URL.git\"}}" --silent --output /dev/stderr --write-out "%{http_code}")
- if [ $STATUSCODE = "202" ]; then exit 0; else exit $STATUSCODE; fi