insert deploy to packagist

This commit is contained in:
Julien Fastré 2016-11-19 19:52:52 +01:00
parent 38ed02b514
commit 9e8afe78c5

View File

@ -1,30 +1,35 @@
services:
- chill/database:latest
.test_definition: &test_definition
services:
- chill/database:latest
before_script:
- composer config github-oauth.github.com $GITHUB_TOKEN
- composer install
- cp Tests/Fixtures/App/config/parameters.gitlab-ci.yml Tests/Fixtures/App/config/parameters.yml
- php Tests/Fixtures/App/console --env=test cache:warmup
- php Tests/Fixtures/App/console doctrine:migrations:migrate --env=test --no-interaction
- php Tests/Fixtures/App/console doctrine:fixtures:load --env=test --no-interaction
stages:
- build-doc
- deploy-doc
- test
- deploy
before_script:
- composer config github-oauth.github.com $GITHUB_TOKEN
- composer install
- cp Tests/Fixtures/App/config/parameters.gitlab-ci.yml Tests/Fixtures/App/config/parameters.yml
- php Tests/Fixtures/App/console --env=test cache:warmup
- php Tests/Fixtures/App/console doctrine:migrations:migrate --env=test --no-interaction
- php Tests/Fixtures/App/console doctrine:fixtures:load --env=test --no-interaction
test:php-5.6:
stage: test
environment: testing
image: chill/ci-image:php-5.6
script: phpunit
stage: test
<<: *test_definition
image: chill/ci-image:php-5.6
script: phpunit
test:php-7:
stage: test
environment: testing
image: chill/ci-image:php-7
script: phpunit
stage: test
<<: *test_definition
image: chill/ci-image:php-7
script: phpunit
# deploy documentation
api-doc-build:
@ -42,3 +47,14 @@ api-doc-build:
only:
- master
- tags
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