From ccacbfa27c26567b3a2181de427cde2a5da26c25 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 20 Jan 2020 13:34:31 +0100 Subject: [PATCH] add .travis.yml with tag release --- .dockerignore | 2 ++ .gitattributes | 2 ++ .travis.yml | 59 ++++++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 63 insertions(+) create mode 100644 .travis.yml diff --git a/.dockerignore b/.dockerignore index 4869ec6e1eb..519c648c076 100644 --- a/.dockerignore +++ b/.dockerignore @@ -32,3 +32,5 @@ docker-compose.dist.yml /docs /sample /var + +.travis.yml export-ignore \ No newline at end of file diff --git a/.gitattributes b/.gitattributes index 296db01ffb5..7fb20848508 100644 --- a/.gitattributes +++ b/.gitattributes @@ -22,3 +22,5 @@ phpunit.xml export-ignore rector.yaml export-ignore utils export-ignore stubs export-ignore + +.travis.yml export-ignore \ No newline at end of file diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 00000000000..036ed1edf2e --- /dev/null +++ b/.travis.yml @@ -0,0 +1,59 @@ +os: linux + +dist: bionic + +language: php + +before_install: + # turn off XDebug + - phpenv config-rm xdebug.ini + +install: + - composer install --no-progress + +stages: + - name: compile + if: (branch = master OR tag IS present) && type = push + - name: phar + if: (branch = master OR tag IS present) && type = push + +jobs: + include: + - + stage: compile + name: "Compile Rector to prefixed PHAR" + php: 7.2 + script: + - cd compiler + - composer install + - bin/compile + - ../tmp/rector.phar + + # inspired by https://github.com/phpstan/phpstan-src/blob/088b9fab470632cea07f08a936fb0923a59b2ecb/.travis.yml#L47-L59 + - + stage: phar + name: "Deploy PHAR to https://github.com/rectorphp/rector-prefixed" + php: 7.2 + script: + # reuse tmp/rector.phar from previous job + - git clone https://${GITHUB_TOKEN}@github.com/rectorphp/rector-prefixed.git rector-prefixed > /dev/null 2>&1 + - cp tmp/rector.phar rector-prefixed/rector.phar + - cp tmp/rector.phar rector-prefixed/rector + - cd rector-prefixed + - git config user.name "TomasVotruba" + - git config user.email "tomas.vot@gmail.com" + - git add rector rector.phar + + - if [ "${TRAVIS_TAG}" != "" ]; then COMMIT_MSG="Rector ${TRAVIS_TAG}"; else COMMIT_MSG="Updated Rector to commit ${TRAVIS_COMMIT}"; fi + + - git commit -m "${COMMIT_MSG}" + - git push --quiet origin master + + - if [ "${TRAVIS_TAG}" != "" ]; then git tag "${TRAVIS_TAG}" && git push --quiet origin ${TRAVIS_TAG}; fi + +cache: + directories: + - $HOME/.composer/cache + +notifications: + email: false