From 09b6ba2e5db96c7bd2ef34279cfc7acb6f15f1cc Mon Sep 17 00:00:00 2001 From: Nabeel Shahzad Date: Fri, 2 Feb 2018 15:39:53 -0600 Subject: [PATCH] Cleanup deployment and release scripts --- .travis.yml | 40 +++++++++++++++++++++------------------- .travis/deploy_script.sh | 11 ++++++----- 2 files changed, 27 insertions(+), 24 deletions(-) diff --git a/.travis.yml b/.travis.yml index 851051be..e2ba28a8 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,34 +1,31 @@ language: php php: - - '7.0' - - '7.1' - - '7.2' - - nightly +- '7.0' +- '7.1' +- '7.2' +- nightly cache: directories: - - $HOME/.composer/cache - - $HOME/.npm + - "$HOME/.composer/cache" + - "$HOME/.npm" services: - - mysql - - redis-server - -addons: - ssh_known_hosts: phpvms.net +- mysql +- redis-server before_script: - cp .travis/env.travis.php env.php - composer install --no-interaction --verbose script: - - php artisan database:create --reset - - php artisan migrate:refresh --seed - - cp .travis/phpunit.travis.xml phpunit.xml - - vendor/bin/phpunit --debug --verbose +- php artisan database:create --reset +- php artisan migrate:refresh --seed +- cp .travis/phpunit.travis.xml phpunit.xml +- vendor/bin/phpunit --debug --verbose after_failure: - - cat storage/logs/*.log +- cat storage/logs/*.log jobs: include: @@ -43,14 +40,19 @@ jobs: on: branch: master php: '7.0' - - stage: deploy + - stage: release script: skip before_deploy: - curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash + - ./.travis/deploy_script.sh deploy: - provider: script + provider: releases skip_cleanup: true - script: ./.travis/deploy_script.sh + api_key: + secure: kAOYEThsSF8wM7vx+e+xWKhlvsNzhgKn1bk0zLBb7RLUM5pHIGKV/j0KrCNspwIUEPF0O594H6hCyswlpIZfxW2mTnmPqfbKxG/H2rLEAoOV0/MqzeC/gffxm7Eop6Sn4T/UC9kLSgqRynllbYtJDK6aWESdnvK3Fka0Cnpn7l/2phEf2J/nOF6QT/utpws1E0MUGqrKvX1/UYIu8np5e5aYLPOXnqahK8qzJFL4CyNBv+fhXuXfmOF4UbNbSPnrg/kY0QpUtFpz9ebvg5BjfMXJT0P4Q1BjgKBN76A7vz+ZfPmW6SqKv3o1yisXAgBWzylXh8B6pK+cUk4uXbagcGcIdkGOI6pQ5sLq+JOkBhVjSfogERePkt44KPif4EMsLRw/Jp4pTMy/vmgrON/jkbA+jXsOARTG5vAwIq4lyZzZXWUfirYwXeCfasgf+xTdo9C0cOE0jlqojO7SdF2CinDk9BduYpBTectea8Xx+YP5R1JCZNORDYynlLHKMW/8PJyAG+AsbcfKNTobQAfxw1nHa7GoKP1j4MSx1UtbulZdhmeRX/nUTFIvfgEDrl4cdBlt0/o5SuyN92DiCnvJZaYHcgXwYMvoqdXxBCnBKsM/1BZcykWi7Zt/q8krWYCOfCzBN4TDdmrKsEOUkCSOL9mI6gERHGmcGZN05PxU950= + file_glob: true + files: build/* on: tags: true + repo: nabeelio/phpvms php: '7.0' diff --git a/.travis/deploy_script.sh b/.travis/deploy_script.sh index 66f0ddb0..caa092d9 100755 --- a/.travis/deploy_script.sh +++ b/.travis/deploy_script.sh @@ -12,15 +12,13 @@ if [ "$TRAVIS" = "true" ]; then TAR_NAME="$FILE_NAME.tar.gz" echo "Writing $TAR_NAME" - # delete all superfluous files - echo "Cleaning files" - cd $TRAVIS_BUILD_DIR php artisan phpvms:version --write > VERSION VERSION=`cat VERSION` echo "Version: $VERSION" + echo "Cleaning files" make clean rm -rf env.php @@ -47,10 +45,13 @@ if [ "$TRAVIS" = "true" ]; then echo "creating tarball" cd /tmp tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR/../ phpvms + sha256sum $TAR_NAME > "$TAR_NAME.sha256" echo "uploading to s3" - cd /tmp/ - sha256sum $TAR_NAME > "$TAR_NAME.sha256" + mkdir -p $TRAVIS_BUILD_DIR/build + cd $TRAVIS_BUILD_DIR/build + + mv "/tmp/$TAR_NAME" "/tmp/$TAR_NAME.sha256" . artifacts upload --target-paths "/" $TAR_NAME $TRAVIS_BUILD_DIR/VERSION $TAR_NAME.sha256 curl -X POST --data "{\"content\": \"A new build is available at http://downloads.phpvms.net/$TAR_NAME ($VERSION)\"}" -H "Content-Type: application/json" $DISCORD_WEBHOOK_URL