Skip to content
This repository has been archived by the owner on Jul 18, 2019. It is now read-only.

Commit

Permalink
ci: build & deploy & notify without human
Browse files Browse the repository at this point in the history
  • Loading branch information
levy committed May 12, 2019
1 parent 403eb45 commit f341186
Show file tree
Hide file tree
Showing 5 changed files with 2,073 additions and 74 deletions.
14 changes: 10 additions & 4 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,24 @@
branches:
only:
- master
language: node_js
node_js:
- lts/*
git:
depth: 3
env:
- API_SERVER=https://easy-mock.com/mock/5c1b3895fe5907404e654045/femessage-mock PUBLIC_PATH=http://levy.work/nuxt-element-dashboard/
install:
- yarn
- yarn --frozen-lockfile
script:
- yarn build
- ./build.sh
after_success:
- GREN_GITHUB_TOKEN=$GITHUB_TOKEN yarn release
- ./notify.sh
cache: yarn
deploy:
provider: pages
skip-cleanup: true
keep-history: true
local-dir: dist
on:
branch: master
github-token: $GITHUB_TOKEN
8 changes: 8 additions & 0 deletions build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/sh
yarn stdver

yarn build

git remote add github https://$GITHUB_TOKEN@github.com/levy9527/nuxt-element-dashboard.git > /dev/null 2>&1
git push github HEAD:master --follow-tags

9 changes: 9 additions & 0 deletions notify.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
url=https://api.github.com/repos/levy9527/nuxt-element-dashboard/releases/latest
html_url=`curl $url | sed -n 5p | sed 's/\"html_url\"://g' | awk -F '"' '{print $2}'`
body=`curl $url | grep body | sed 's/\"body\"://g;s/\"//g'`

msg='{"msgtype": "markdown", "markdown": {"title": "新版本发布", "text": "@所有人\n# ['$html_url']('$html_url')\n'$body'"}}'

curl -X POST https://oapi.dingtalk.com/robot/send\?access_token\=$DINGTALK_ROBOT_TOKEN -H 'Content-Type: application/json' -d "$msg"

6 changes: 5 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
"start": "cross-env HOST=0.0.0.0 PORT=3333 MODE=prod nuxt start",
"start:docker": "nuxt start",
"generate": "cross-env MODE=prod nuxt generate",
"deploy": "now --npm --public"
"deploy": "now --npm --public",
"stdver": "standard-version -m '[skip ci] chore(release): v%s'",
"release": "gren release --override"
},
"dependencies": {
"@femessage/el-form-renderer": "^1.3.0",
Expand All @@ -47,9 +49,11 @@
"eslint-friendly-formatter": "^3.0.0",
"eslint-loader": "^1.7.1",
"eslint-plugin-vue": "^4.0.0",
"github-release-notes": "^0.17.0",
"husky": "^1.3.1",
"lint-staged": "^8.1.0",
"prettier": "^1.16.0",
"standard-version": "^6.0.1",
"stylelint": "^9.10.0",
"stylelint-config-standard": "^18.2.0"
},
Expand Down
Loading

0 comments on commit f341186

Please sign in to comment.