File tree Expand file tree Collapse file tree 1 file changed +92
-0
lines changed
Expand file tree Collapse file tree 1 file changed +92
-0
lines changed Original file line number Diff line number Diff line change 1+ #! bash
2+
3+ program_exists () {
4+ local ret=' 0'
5+ command -v $1 > /dev/null 2>&1 || { local ret=' 1' ; }
6+
7+ # fail on non-zero return value
8+ if [ " $ret " -ne 0 ]; then
9+ echo " command $1 notfound, exit..."
10+ return 1
11+ fi
12+
13+ return 0
14+ }
15+
16+ show_usage () {
17+ echo " Usage: $0 <version>"
18+ exit 1
19+ }
20+
21+ version=$1
22+
23+ if [ -z $version ]; then
24+ echo " error: please input release version!"
25+ show_usage
26+ fi
27+
28+ set -e
29+ program_exists git
30+ program_exists 7z
31+ program_exists tsc
32+ program_exists python
33+
34+ cd " $( dirname " $0 " ) "
35+
36+ # Determine if git working space clean
37+ if [ -n " $( git status --porcelain| grep -v CHANGELOG.md) " ]; then
38+ echo " git working space not clean"
39+ exit 1
40+ fi
41+
42+ # remind
43+ echo " Check List:"
44+ echo " * Is CHANGELOG.md ready to release?"
45+ read
46+
47+ echo " start..."
48+
49+ # edit version
50+ sed -i " s/\" .*\" /\" ${version} \" /" ./src/version.ts
51+
52+ # build
53+ ./build.sh
54+
55+ # prepare to pack
56+ PACK_DIR=./build/pack
57+ p () {
58+ if [ -z $1 ]; then
59+ return 1
60+ fi
61+ cp -v $1 ${PACK_DIR} /
62+ return $?
63+ }
64+
65+ mkdir -p ${PACK_DIR}
66+ rm -rf ./${PACK_DIR} /*
67+
68+ # edit changelog
69+ cp -v CHANGELOG.md ${PACK_DIR} /
70+ date=` date +%Y-%m-%d`
71+ sed -i " s/\[Unreleased\]/\[${version} \] - ${date} /" $PACK_DIR /CHANGELOG.md
72+
73+ p build/LabelPlus_Ps_Script.jsx
74+ p LICENSE.txt
75+ p README.md
76+ 7z a -t7z build/LabelPlus_PS-Script_${version} .7z ${PACK_DIR} /* -m0=BCJ -m1=LZMA:d=21 -ms -mmt
77+
78+ # git commit, add tag
79+ cp ${PACK_DIR} /CHANGELOG.md ./
80+ TEXT=" \n## [Unreleased]\n### Added\n### Changed\n### Fixed\n### Removed\n"
81+ sed " 1a\\ ${TEXT} " CHANGELOG.md -i
82+
83+ git commit -am " release ${version} "
84+ git tag ${version}
85+
86+ echo " "
87+ echo " ============================="
88+ echo " complete!"
89+ echo " please check and push new commit & tag, command:"
90+ echo " git push"
91+ echo " git push origin ${version} "
92+
You can’t perform that action at this time.
0 commit comments