diff --git a/.travis.yml b/.travis.yml index 13ded6a3..43fe36f9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -36,7 +36,7 @@ before_deploy: deploy: - skip_cleanup: true provider: script - script: ./build/deploy_gh_pages.sh + script: npm run deploy on: branch: master condition: $JOB != e2e diff --git a/build/deploy_gh_pages.sh b/build/deploy_gh_pages.sh deleted file mode 100755 index c676d79e..00000000 --- a/build/deploy_gh_pages.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/bash -set -o pipefail -( - set -e - set -x - cd demo - git init - git config user.name "Travis-CI" - git config user.email "travis@travis" - cp -r ../dist ./dist - git add . - git commit -m "Deployed to Github Pages" - git push --force "https://${GH_TOKEN}@${GH_REF}" master:gh-pages 2>&1 -) 2>&1 | sed "s/${GH_TOKEN}/xxPASSxx/" diff --git a/build/prepare_deploy.sh b/build/prepare_deploy.sh new file mode 100755 index 00000000..c55a08ae --- /dev/null +++ b/build/prepare_deploy.sh @@ -0,0 +1,6 @@ +#!/bin/bash +set -e +set -x +cd demo +cp -R ../dist ./dist +cd - diff --git a/package.json b/package.json index 47ac0303..b68ac48d 100644 --- a/package.json +++ b/package.json @@ -14,7 +14,8 @@ "build-dist": "gulp build", "branch-release": "git reset --hard && branch-release", "unit": "gulp test", - "e2e": "gulp e2e" + "e2e": "gulp e2e", + "deploy": "build/prepare_deploy.sh && deploy-to-gh-pages demo" }, "keywords": [ "Swagger", @@ -55,6 +56,7 @@ "branch-release": "^0.3.1", "browser-sync": "^2.10.1", "del": "^2.2.0", + "deploy-to-gh-pages": "^1.0.0", "gulp": "^3.9.0", "gulp-concat": "^2.6.0", "gulp-eslint": "^1.1.1",