UNPKG

2.86 kBapplication/x-shView Raw
1#!/bin/bash
2
3set -ex
4
5target_version=$1
6current_version=`node -e "console.log(require('./package').version)"`
7version_start=`echo $current_version | cut -d '.' -f 1-2`
8
9echo "Current version: $current_version"
10
11build_docs () {
12 # target version not start with current version
13 if [[ ! $1 == $version_start* ]]; then
14 echo "Building docs: $current_version"
15 git checkout master
16 git pull
17 yarn docs
18 mv _gh_pages $current_version
19 git checkout gh-pages
20 git pull
21 mv $current_version versions/
22 git add versions/$current_version
23 git commit -m "Add $current_version"
24 git push
25 fi
26}
27
28update_version () {
29 echo "Updating version: $target_version"
30 git checkout develop
31 git pull
32 node tools/release.js $target_version $version_start
33}
34
35build_dist () {
36 echo "Building dist"
37 yarn build
38 git add dist
39 git commit -a -m "Build $target_version"
40 git push
41}
42
43merge_develop () {
44 echo "Merging develop to master"
45 git checkout master
46 git pull
47 git merge develop
48 git push -u origin master
49}
50
51add_tag () {
52 echo "Adding tag: $target_version"
53 git tag $target_version
54 git push --tags
55}
56
57npm_publish () {
58 echo "NPM publishing"
59 npm publish --registry=https://registry.npmjs.org
60}
61
62update_algolia_and_live () {
63 echo "Updating algolia and bootstrap-table-live"
64 ALGOLIA_API_KEY='94b423a877c9386f44876be39c7ace24' bundle exec jekyll algolia
65
66 cd tools
67 node get-extensions-list.js
68 cd ..
69}
70
71replace_version () {
72 sed -i '' -e "s/version\": \"$current_version/version\": \"$target_version/g" $1
73}
74
75replace_npm_version () {
76 sed -i '' -e "s/bootstrap-table\": \"^$current_version/bootstrap-table\": \"^$target_version/g" $1
77}
78
79replace_cdn_version () {
80 sed -i '' -e "s/bootstrap-table@$current_version/bootstrap-table@$target_version/g" $1
81}
82
83update_bootstrap_table_examples () {
84 echo "Updating bootstrap-table-examples"
85 cd ../bootstrap-table-examples
86 git checkout develop
87 git pull
88
89 replace_version package.json
90 replace_npm_version vue-starter/package.json
91 replace_npm_version webpack-starter/package.json
92 replace_cdn_version welcome.html
93 replace_cdn_version assets/js/template.js
94 replace_cdn_version crud/index.html
95 replace_cdn_version options/table-locale.html
96 replace_cdn_version welcomes/vue-component.html
97
98 git commit -a -m "Build $target_version"
99
100 merge_develop
101
102 cd tools
103 node algolia.js
104 node data.js
105
106 cd ../../bootstrap-table
107}
108
109update_bootstrap_table_live () {
110 echo "Updating bootstrap-table-live"
111 cd ../bootstrap-table-live
112 node tools/release.js $target_version
113 git commit -a -m "Add $target_version"
114 git pull --rebase
115 git push
116
117 cd static
118 ./deploy.sh
119 cd ../../bootstrap-table
120}
121
122# build_docs
123# update_version
124# build_dist
125# merge_develop
126# add_tag
127npm_publish
128update_algolia_and_live
129update_bootstrap_table_examples
130update_bootstrap_table_live