Browse Source

feat: 添加travis持续集成

kang.wang 5 years ago
parent
commit
5e8d48ecb7
2 changed files with 35 additions and 0 deletions
  1. 10 0
      .travis.yml
  2. 25 0
      deploy.sh

+ 10 - 0
.travis.yml

@@ -0,0 +1,10 @@
+language: node_js
+sudo: required
+node_js:
+  - 8.11.3
+cache:
+  directories:
+    - node_modules
+script:
+    - ./deploy.sh
+branch: master

+ 25 - 0
deploy.sh

@@ -0,0 +1,25 @@
+#!/usr/bin/env sh
+
+# 确保脚本抛出遇到的错误
+set -e
+
+# 生成静态文件
+npm run build
+
+# 进入生成的文件夹
+cd b2c
+
+# 如果是发布到自定义域名
+# echo 'www.example.com' > CNAME
+
+git init
+git add -A
+git commit -m 'deploy'
+
+# 如果发布到 https://<USERNAME>.github.io
+git push -f git@github.com:allpayx/allpayx.github.io.git master
+
+# 如果发布到 https://<USERNAME>.github.io/<REPO>
+# git push -f git@github.com:<USERNAME>/<REPO>.git master:gh-pages
+
+cd -