Cleanup deployment and release scripts

This commit is contained in:
Nabeel Shahzad 2018-02-02 15:39:53 -06:00
parent b23675e631
commit 09b6ba2e5d
2 changed files with 27 additions and 24 deletions

View File

@ -1,34 +1,31 @@
language: php language: php
php: php:
- '7.0' - '7.0'
- '7.1' - '7.1'
- '7.2' - '7.2'
- nightly - nightly
cache: cache:
directories: directories:
- $HOME/.composer/cache - "$HOME/.composer/cache"
- $HOME/.npm - "$HOME/.npm"
services: services:
- mysql - mysql
- redis-server - redis-server
addons:
ssh_known_hosts: phpvms.net
before_script: before_script:
- cp .travis/env.travis.php env.php - cp .travis/env.travis.php env.php
- composer install --no-interaction --verbose - composer install --no-interaction --verbose
script: script:
- php artisan database:create --reset - php artisan database:create --reset
- php artisan migrate:refresh --seed - php artisan migrate:refresh --seed
- cp .travis/phpunit.travis.xml phpunit.xml - cp .travis/phpunit.travis.xml phpunit.xml
- vendor/bin/phpunit --debug --verbose - vendor/bin/phpunit --debug --verbose
after_failure: after_failure:
- cat storage/logs/*.log - cat storage/logs/*.log
jobs: jobs:
include: include:
@ -43,14 +40,19 @@ jobs:
on: on:
branch: master branch: master
php: '7.0' php: '7.0'
- stage: deploy - stage: release
script: skip script: skip
before_deploy: before_deploy:
- curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash - curl -sL https://raw.githubusercontent.com/travis-ci/artifacts/master/install | bash
- ./.travis/deploy_script.sh
deploy: deploy:
provider: script provider: releases
skip_cleanup: true 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: on:
tags: true tags: true
repo: nabeelio/phpvms
php: '7.0' php: '7.0'

View File

@ -12,15 +12,13 @@ if [ "$TRAVIS" = "true" ]; then
TAR_NAME="$FILE_NAME.tar.gz" TAR_NAME="$FILE_NAME.tar.gz"
echo "Writing $TAR_NAME" echo "Writing $TAR_NAME"
# delete all superfluous files
echo "Cleaning files"
cd $TRAVIS_BUILD_DIR cd $TRAVIS_BUILD_DIR
php artisan phpvms:version --write > VERSION php artisan phpvms:version --write > VERSION
VERSION=`cat VERSION` VERSION=`cat VERSION`
echo "Version: $VERSION" echo "Version: $VERSION"
echo "Cleaning files"
make clean make clean
rm -rf env.php rm -rf env.php
@ -47,10 +45,13 @@ if [ "$TRAVIS" = "true" ]; then
echo "creating tarball" echo "creating tarball"
cd /tmp cd /tmp
tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR/../ phpvms tar -czf $TAR_NAME -C $TRAVIS_BUILD_DIR/../ phpvms
sha256sum $TAR_NAME > "$TAR_NAME.sha256"
echo "uploading to s3" echo "uploading to s3"
cd /tmp/ mkdir -p $TRAVIS_BUILD_DIR/build
sha256sum $TAR_NAME > "$TAR_NAME.sha256" 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 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 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