From 18efe2729d9c011bfbc4181dc1858ee75b9e110c Mon Sep 17 00:00:00 2001 From: tangjinzhou <415800467@qq.com> Date: Mon, 22 Jan 2018 18:13:46 +0800 Subject: [PATCH] add travis --- .gitignore | 1 + .travis.yml | 9 +-------- scripts/deploy-to-gh-pages.sh | 28 ++++++++++++++++++++++++++++ webpack.prod.config.js | 2 +- 4 files changed, 31 insertions(+), 9 deletions(-) create mode 100644 scripts/deploy-to-gh-pages.sh diff --git a/.gitignore b/.gitignore index 6cbb08205..9416a7fd1 100644 --- a/.gitignore +++ b/.gitignore @@ -58,3 +58,4 @@ typings/ .env .idea .DS_Store +dist/ diff --git a/.travis.yml b/.travis.yml index 1e5896beb..92e534cd0 100644 --- a/.travis.yml +++ b/.travis.yml @@ -11,15 +11,8 @@ deploy: keep-history: true on: branch: master -before_script: -- git checkout origin/gh-pages -- git rebase master script: -- npm run build -after_success: -- git add --all . -- git commit -m "travis ci auto build" -- git push --force origin gh-pages + - bash ./scripts/deploy-to-gh-pages.sh env: matrix: secure: PBbJaS48HA/mkj9PuGuRxs00DEJR77XfuPdSlTvCq0QxLIR6wIO+t3LLJdOQctZIX6KWBR/Zq3zSn5bRxgPIaRcoyuEU25ga4cexJMEh1ymE23uTiDcnWwWN0X1jZKGuHPvqVKjyToAv6XW24mTXNvEAqD2uL101JxBseoWJ/2VtyOjJFJwcGbw+MTLymWCZiAF10w+k0SyigawaxZLlYL9LZXv4w3oCjCwuiTD/T6rvyT3wGQzXx7/P7XQGL4el4lE7leuK5m2PhWvX2S3t2FRpoZPw0DINJu5XzuBr3DSMErQjCrP4Ep8iqW8pGGLkoXbcxK3/K+uSy0k+DdBN7jRgnnOeLpqeVUSMaM6LRnl2XyDWL3dKpVbEzZaFkRTmAwdbgYjI+7Enn3/GtseMASo/gK47m2k+kE/msoqwpTGLC5DBOBKxdNShdFnEbOxLUUiVNgoZRXbj6VhdueqK89LsMDsnxzmFtrU8Ytgv8wJsFd5IkIhCStmQ9bdTqER659hd1Qqdh6Qe36AfpZcetOLr86Z++CSwA/pZbLPeEVrfCHDh6V3DPQXG+Zlf/m60OAmhosJ+4dxZwRnR8LnaDFZ+uLYMz+vJGeOtFHvczz7TW4mznjguLE51crG+mkBGT2dx1UUg7zs41lz3GtH9WY8cSG4y5ryjDl6YkXwoiZI= diff --git a/scripts/deploy-to-gh-pages.sh b/scripts/deploy-to-gh-pages.sh new file mode 100644 index 000000000..073462962 --- /dev/null +++ b/scripts/deploy-to-gh-pages.sh @@ -0,0 +1,28 @@ +#!/bin/bash + +set -e # exit with nonzero exit code if anything fails + +if [[ $TRAVIS_BRANCH == "master" && $TRAVIS_PULL_REQUEST == "false" ]]; then + +echo "Starting to update gh-pages\n" + +rm -rf dist +mkdir dist + +git config --global user.email "travis@travis-ci.org" +git config --global user.name "Travis" + +./node_modules/.bin/webpack --config webpack.prod.config.js + +cd dist +git init +git add -f . +git commit -m "Travis build" +git push --force --quiet https://${GITHUB_TOKEN}@github.com/vueComponent/ant-design.git master:gh-pages > /dev/null + + +echo "Done updating gh-pages\n" + +else + echo "Skipped updating gh-pages, because build is not triggered from the master branch." +fi; diff --git a/webpack.prod.config.js b/webpack.prod.config.js index 80ca0c196..4c23f740c 100644 --- a/webpack.prod.config.js +++ b/webpack.prod.config.js @@ -17,7 +17,7 @@ module.exports = { }, output: { path: path.resolve(__dirname, './dist'), - publicPath: './dist/', + publicPath: './', filename: '[name].[chunkhash].js', chunkFilename: '[chunkhash].async.js', },