diff --git a/.gitignore b/.gitignore index ba18a1a..7bb6936 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,7 @@ /puli.json /box.json /.puli +/.idea +*.iml +.travis/build-key.pem +.travis/secrets.tar diff --git a/.travis.yml b/.travis.yml index 3372d19..9eff210 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,17 +1,16 @@ language: php - sudo: false - cache: directories: - - $HOME/.composer/cache/files - + - $HOME/.composer/cache/files matrix: include: - php: 5.3 - php: 5.4 - php: 5.5 - php: 5.6 + env: + - EXECUTE_DEPLOYMENT=true - php: hhvm - php: nightly - php: 7.0 @@ -34,9 +33,25 @@ script: if [[ $COVERAGE = yes ]]; then vendor/bin/phpunit --verbose --coverage-c after_script: if [[ $COVERAGE = yes ]]; then wget https://scrutinizer-ci.com/ocular.phar && php ocular.phar code-coverage:upload --format=php-clover coverage.clover; fi +after_success: + - openssl aes-256-cbc -K $encrypted_7a05c4e35c71_key -iv $encrypted_7a05c4e35c71_iv + -in .travis/secrets.tar.enc -out .travis/secrets.tar -d + - if [[ $EXECUTE_DEPLOYMENT == 'true' && ($TRAVIS_BRANCH == 'master' || $TRAVIS_TAG != '') && $TRAVIS_PULL_REQUEST == 'false' ]]; then composer install --no-dev ; fi + - if [[ $EXECUTE_DEPLOYMENT == 'true' && ($TRAVIS_BRANCH == 'master' || $TRAVIS_TAG != '') && $TRAVIS_PULL_REQUEST == 'false' ]]; then ./bin/deploy.sh ; fi + - if [[ $EXECUTE_DEPLOYMENT == 'true' && ($TRAVIS_BRANCH == 'master' || $TRAVIS_TAG != '') && $TRAVIS_PULL_REQUEST == 'false' ]]; then ./puli.phar ; fi + notifications: webhooks: urls: ['https://webhooks.gitter.im/e/9ccc2378e6c0de6480f8'] on_success: change on_failure: always on_start: never + +deploy: + - provider: releases + skip_cleanup: true + api_key: + secure: XufYEOR4sihf4gJ9zTizrupydaQnkCVZLDbdXRAmfVNgDQNkSI2a8aKyGxxH2YTmJn65DHiFAuNMv5LIwG1e1XuiuW4ZFsEOj7o+qV5NZCzkTiYY4qYVlsut2lk8Y6dOaJl9wjvBKxK/ELbs66M4NS/3qSluaGAL1K3DtuBzF0MFLT0S4HhwoYkkJaTx3XZcCNSJA7kxT/yhSpMOhlmVXw89yJbxHiVya/YVLBHGSFpN8WpHSYxZuOnWw4OZrvS/Le+v9cvxqK1JLzV6tKe6X3DtBRzyVoO+c0CXm7Q0nn+HYtuZHnn2uOsLb68kRo8R2jjRImF/q6xdhoUHmrKFa8GgaVZkYHoCYVIbX0e2DzLvgo5DXEs1H8sNKFBjI0zRj8B9CDV6Blqap3a4d6JBsmmTAt4sFENWU4Gekv/vfB9PEIjmbLl+5/YHQcHtzU+kMnAGzpJ2d+M9BOjiUPdEHSek7vaEdE5ySAMM/0PZo2y9ZP1Go7yzHybip3WdLO6G8Q0HOoYUL0orJ9rZOT+NYBIgWXHymyFM2TJvoGlgsQRzagVseyH8qbmGo1FuMrTGePYjCo00xT3S2RgW4nXMPi0Qx6dsTUqGZDr8v1Qz2gKJlgP/a7Wpd+P1km+ibkVyqb94CgCx3Ryxf7YBplUuPT9Th+f/AiGOFh9OLA729M4= + file: puli.phar + on: + tags: true diff --git a/.travis/secrets.tar.enc b/.travis/secrets.tar.enc new file mode 100644 index 0000000..6b03ade Binary files /dev/null and b/.travis/secrets.tar.enc differ diff --git a/DEPLOY.md b/DEPLOY.md new file mode 100644 index 0000000..073a085 --- /dev/null +++ b/DEPLOY.md @@ -0,0 +1,9 @@ +# Deploy + +``` +ssh-keygen -t rsa -b 4096 -C "" +``` + +* store deploy key in github + +cp $HOME/.ssh/_rsa .travis/build-key.pem diff --git a/bin/deploy.sh b/bin/deploy.sh new file mode 100644 index 0000000..eb6d8b9 --- /dev/null +++ b/bin/deploy.sh @@ -0,0 +1,39 @@ +#!/bin/bash +# Unpack secrets; -C ensures they unpack *in* the .travis directory +tar xvf .travis/secrets.tar -C .travis + +# Setup SSH agent: +eval "$(ssh-agent -s)" #start the ssh agent +chmod 600 .travis/build-key.pem +ssh-add .travis/build-key.pem + +# Get box and build PHAR +wget https://box-project.github.io/box2/manifest.json +BOX_URL=$(php bin/parse-manifest.php manifest.json) +rm manifest.json +wget -O box.phar ${BOX_URL} +chmod 755 box.phar +./box.phar build -vv + +# TODO if build with gh-pages + +# Setup git defaults: +# TODO set username and email +# git config --global user.email "johannes.wachter@outlook.com" +# git config --global user.name "Johannes Wachter" + +# Add SSH-based remote to GitHub repo: +# TODO remote +# git remote add deploy git@github.com:wachterjohannes/cli.git +# git fetch deploy + +# Checkout gh-pages and add PHAR file and version: +# git checkout -b gh-pages deploy/gh-pages +# git pull deploy gh-pages +# mv build/* ./puli.phar +# sha1sum puli.phar > puli.phar.version +# git add puli.phar puli.phar.version + +# Commit and push: +# git commit -m 'Rebuilt phar' +# git push deploy gh-pages:gh-pages diff --git a/bin/parse-manifest.php b/bin/parse-manifest.php new file mode 100644 index 0000000..2503735 --- /dev/null +++ b/bin/parse-manifest.php @@ -0,0 +1,30 @@ +=')) { + echo $file['url']; + exit(0); + } +} + +echo $fallbackUrl; +exit(0);