diff --git a/.elasticbeanstalk/config.yml b/.elasticbeanstalk/config.yml deleted file mode 100644 index 6ac17fc..0000000 --- a/.elasticbeanstalk/config.yml +++ /dev/null @@ -1,12 +0,0 @@ -branch-defaults: - release/prod: - environment: keyserver-prod - release/test: - environment: keyserver-test -global: - application_name: keyserver - default_ec2_keyname: null - default_platform: Node.js - default_region: eu-west-1 - profile: eb-cli - sc: git diff --git a/.travis.yml b/.travis.yml index c2c4e5f..ef916cd 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,13 +1,35 @@ sudo: false language: node_js node_js: - - "6" -before_script: - - mongo test_db --eval 'db.addUser("travis", "test");' + - "8" + +env: + - NODE_ENV=integration MONGO_URI=127.0.0.1:27017/test_db MONGO_USER=travis MONGO_PASS=test + notifications: email: - build@mailvelope.com + services: - mongodb -env: - - NODE_ENV=integration MONGO_URI=127.0.0.1:27017/test_db MONGO_USER=travis MONGO_PASS=test \ No newline at end of file + +before_script: + - mongo test_db --eval 'db.addUser("travis", "test");' + +before_deploy: + - npm run release + +deploy: + skip_cleanup: true + provider: elasticbeanstalk + access_key_id: $AWS_ACCESS_KEY + secret_access_key: $AWS_SECRET_ACCESS_KEY + region: eu-west-1 + app: keyserver + env: keyserver-prod + zip_file: release.zip + bucket_name: elasticbeanstalk-eu-west-1-936909551620 + bucket_path: keyserver + on: + repo: mailvelope/keyserver + branch: master diff --git a/package.json b/package.json index 9d50215..db7a497 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "mailvelope-keyserver", - "version": "1.2.6", + "version": "2.0.0", "license": "AGPL-3.0", "repository": { "type": "git", "url": "https://github.com/mailvelope/keyserver.git" }, "engines": { - "node": ">=6" + "node": ">=8" }, "scripts": { "start": ": ${NODE_ENV=development} && node index.js", @@ -15,7 +15,10 @@ "test:jshint": "jshint *.js src/**/*.js test/**/*.js", "test:jscs": "jscs *.js src/**/*.js test/**/*.js", "test:unit": "mocha --opts test/mocha.opts ./test/unit/", - "test:integration": "mocha --opts test/mocha.opts ./test/integration" + "test:integration": "mocha --opts test/mocha.opts ./test/integration", + "release": "npm run release:install && npm run release:archive", + "release:install": "rm -rf node_modules/ && npm install --production", + "release:archive": "zip -rq release.zip package.json package-lock.json node_modules/ *.js src/ config/" }, "dependencies": { "addressparser": "^1.0.1", diff --git a/res/aws_release.sh b/res/aws_release.sh deleted file mode 100755 index 8d9d109..0000000 --- a/res/aws_release.sh +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# go to root -cd `dirname $0` -cd .. - -if [ "$1" != "prod" ] && [ "$1" != "test" ] ; then - echo 'Usage: ./res/aws_release prod|test' - exit 0 -fi - -# switch branch -git checkout master -git branch -D release/$1 -git checkout -b release/$1 -git merge master --no-edit - -# abort if tests fail -set -e - -# build and test -rm -rf node_modules -npm install -npm test - -# install only production dependencies -rm -rf node_modules/ -npm install --production - -# delete .gitignore files before adding to git for aws deployment -find node_modules/ -name ".gitignore" -exec rm -rf {} \; - -# Add runtime dependencies to git -sed -i "" '/node_modules/d' .gitignore -git add .gitignore node_modules/ -git commit -m "Update release" - -# push to aws -eb deploy keyserver-$1 - -# switch back to master branch -git checkout master -npm install