1 | #!/bin/bash
|
2 |
|
3 | set -ex
|
4 |
|
5 | target_version=$1
|
6 | current_version=`node -e "console.log(require('./package').version)"`
|
7 | version_start=`echo $current_version | cut -d '.' -f 1-2`
|
8 |
|
9 | echo "Current version: $current_version"
|
10 |
|
11 | build_docs () {
|
12 |
|
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 |
|
28 | update_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 |
|
35 | build_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 |
|
43 | merge_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 |
|
51 | add_tag () {
|
52 | echo "Adding tag: $target_version"
|
53 |
|
54 | git push --tags
|
55 | }
|
56 |
|
57 | npm_publish () {
|
58 | echo "NPM publishing"
|
59 | npm publish --registry=https://registry.npmjs.org
|
60 | }
|
61 |
|
62 | update_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 |
|
71 | replace_version () {
|
72 | sed -i '' -e "s/version\": \"$current_version/version\": \"$target_version/g" $1
|
73 | }
|
74 |
|
75 | replace_npm_version () {
|
76 | sed -i '' -e "s/bootstrap-table\": \"^$current_version/bootstrap-table\": \"^$target_version/g" $1
|
77 | }
|
78 |
|
79 | replace_cdn_version () {
|
80 | sed -i '' -e "s/bootstrap-table@$current_version/bootstrap-table@$target_version/g" $1
|
81 | }
|
82 |
|
83 | update_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 |
|
110 | update_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 |
|
124 |
|
125 |
|
126 |
|
127 | add_tag
|
128 | npm_publish
|
129 | update_algolia_and_live
|
130 | update_bootstrap_table_examples
|
131 | update_bootstrap_table_live
|