UNPKG

2.87 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 git push
100
101 merge_develop
102
103 cd tools
104 node algolia.js
105 node data.js
106
107 cd ../../bootstrap-table
108}
109
110update_bootstrap_table_live () {
111 echo "Updating bootstrap-table-live"
112 cd ../bootstrap-table-live
113 node tools/release.js $target_version
114 git commit -a -m "Add $target_version"
115 git pull --rebase
116 git push
117
118 cd static
119 ./deploy.sh
120 cd ../../bootstrap-table
121}
122
123# build_docs
124# update_version
125# build_dist
126# merge_develop
127add_tag
128npm_publish
129update_algolia_and_live
130update_bootstrap_table_examples
131update_bootstrap_table_live