Skip to content

Commit 2f9d7e3

Browse files
authored
fix: tcp-server deps error (#468)
fix: tcp-server deps error
2 parents bbe5dd7 + 36c12c9 commit 2f9d7e3

File tree

4 files changed

+220
-134
lines changed

4 files changed

+220
-134
lines changed

script/delete-tag.sh

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,17 @@
11
#!/usr/bin/env bash
22

33
TAG=$1
4-
COMPONENTS=$(ls src/)
54

65
# import common functions
76
source "$(dirname $0)/common-func.sh"
87

8+
# update one
9+
if [[ "$2" != "" ]]; then
10+
COMPONENTS=$@
11+
else
12+
COMPONENTS=$(ls src/)
13+
fi
14+
915
for LIB_NAME in ${COMPONENTS} ; do
1016
colored_text "\n====== Releasing the component:【${LIB_NAME}" cyan
1117

script/release-tag-new.sh

Lines changed: 162 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,162 @@
1+
#!/usr/bin/env bash
2+
#
3+
#
4+
5+
#set -e
6+
7+
# import common functions
8+
source "$(dirname $0)/common-func.sh"
9+
10+
function show_help() {
11+
binName="bash $(basename $0)"
12+
13+
cat <<EOF
14+
Release all sub-repo to new tag version and push to remote repo
15+
16+
Usage:
17+
${binName} [-t VERSION] [NAME ...]
18+
19+
Options:
20+
-a Release all components
21+
-t <version> Specifies the version number to be published,
22+
without specifying the automatic calculation of the next version.
23+
eg: v2.0.4
24+
-y No confirmation required
25+
-h, --help Display the help information
26+
27+
Example:
28+
${binName} -a Release all components, will auto calc next version
29+
${binName} -t v2.0.4 -a Release all components, use user input version
30+
${binName} -t v2.0.4 event Release one component
31+
${binName} -t v2.0.4 event stdlib Release multi components
32+
33+
EOF
34+
exit 0
35+
}
36+
37+
# 显示帮助
38+
[[ "$1" = "" || "$1" = "-h" || "$1" = "--help" ]] && show_help
39+
40+
RELEASE_TAG=AUTO
41+
NEED_CONFIRM=Y
42+
43+
# parse input options
44+
# ref https://www.cnblogs.com/yxzfscg/p/5338775.html
45+
while getopts "t:ahy" arg; do #选项后面的冒号表示该选项需要参数
46+
case ${arg} in
47+
a)
48+
COMPONENTS=$(ls src/) ;;
49+
h)
50+
show_help ;;
51+
y)
52+
NEED_CONFIRM=N ;;
53+
t)
54+
RELEASE_TAG=$OPTARG ;;
55+
?) #当有不认识的选项的时候arg为?
56+
echo "Missing argument"
57+
exit 1
58+
;;
59+
esac
60+
done
61+
62+
shift $(($OPTIND - 1))
63+
64+
TARGET_BRANCH=master
65+
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
66+
#CURRENT_BRANCH=master
67+
68+
[[ -n "$@" ]] && COMPONENTS=$@
69+
70+
if [[ -z "${COMPONENTS}" ]]; then
71+
colored_text "Please input want released component names or use option: -a" red
72+
exit 1
73+
fi
74+
75+
echo "Will released version: ${RELEASE_TAG}"
76+
echo "Will released projects:"
77+
echo " " ${COMPONENTS}
78+
#colored_text "${COMPONENTS}"
79+
80+
if [[ "$NEED_CONFIRM" = "Y" ]]; then
81+
if ! user_confirm "Continue"; then
82+
colored_text "Good Bye"
83+
exit 0
84+
fi
85+
fi
86+
87+
TMP_DIR="/tmp/release-components-git"
88+
89+
yellow_text "> rm -rf ${TMP_DIR} && mkdir ${TMP_DIR}"
90+
rm -rf ${TMP_DIR} && mkdir ${TMP_DIR};
91+
#pwd
92+
yellow_text "> cp -R $(pwd)/. ${TMP_DIR}"
93+
cp -R $(pwd)/. ${TMP_DIR}
94+
#cd ${TMP_DIR} && git checkout . && pwd;
95+
cd ${TMP_DIR} && git checkout . && pwd;
96+
97+
for LIB_NAME in ${COMPONENTS} ; do
98+
colored_text "\n====== Releasing the component:【${LIB_NAME}" cyan
99+
100+
# REMOTE_URL=`git remote get-url ${LIB_NAME}`
101+
# REMOTE_URL="git@github.com:swoft-cloud/swoft-${LIB_NAME}.git"
102+
103+
colored_text "Check sub-component remote"
104+
yellow_text "> git remote -v | grep ${LIB_NAME}"
105+
REMOTE_INFO=`git remote -v | grep ${LIB_NAME}`
106+
107+
if [[ -z "$REMOTE_INFO" ]]; then
108+
red_text "Not found remote for the component: ${LIB_NAME}"
109+
continue
110+
fi
111+
112+
yellow_text "> git pull ${LIB_NAME}"
113+
git pull ${LIB_NAME};
114+
115+
NEW_BRANCH=${LIB_NAME}-master
116+
117+
yellow_text "> git checkout -b ${NEW_BRANCH} ${LIB_NAME}/master"
118+
git checkout -b ${NEW_BRANCH} ${LIB_NAME}/master;
119+
120+
yellow_text "> git pull ${LIB_NAME} ${TARGET_BRANCH}"
121+
git pull ${LIB_NAME} ${TARGET_BRANCH};
122+
123+
# like: v2.0.0
124+
LAST_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))
125+
126+
# this is first release
127+
if [[ -z "$LAST_RELEASE" ]]; then
128+
if [[ "$RELEASE_TAG" = "AUTO" ]]; then
129+
read -p "Please input release tag version: " RELEASE_TAG
130+
fi
131+
132+
colored_text "There has not been any releases. Releasing $RELEASE_TAG";
133+
else
134+
# auto find next version tag
135+
if [[ "$RELEASE_TAG" = "AUTO" ]]; then
136+
RELEASE_TAG=$(php dtool.php git:tag --only-tag --next-tag ${LAST_RELEASE})
137+
fi
138+
139+
echo "Last release $LAST_RELEASE";
140+
141+
CHANGES_SINCE_LAST_RELEASE=$(git log --oneline --decorate "$LAST_RELEASE"...master)
142+
143+
if [[ ! -z "$CHANGES_SINCE_LAST_RELEASE" ]]; then
144+
colored_text "There are changes since last release. Releasing $RELEASE_TAG";
145+
else
146+
blue_text "No any change since last release. Skip release";
147+
continue
148+
fi
149+
fi
150+
151+
# git tag $1 -s -m "Release $RELEASE_TAG"
152+
yellow_text "> git tag -a $1 -m \"Release $RELEASE_TAG\""
153+
git tag -a ${RELEASE_TAG} -m "Release $RELEASE_TAG";
154+
155+
yellow_text "> git push $LIB_NAME origin $RELEASE_TAG"
156+
git push ${LIB_NAME} ${RELEASE_TAG};
157+
done
158+
159+
yellow_text "> git checkout ${CURRENT_BRANCH}"
160+
git checkout ${CURRENT_BRANCH}
161+
162+
colored_text "\nRelease Completed!"

script/release-tag.sh

Lines changed: 50 additions & 132 deletions
Original file line numberDiff line numberDiff line change
@@ -1,162 +1,80 @@
11
#!/usr/bin/env bash
22
#
3-
#
4-
5-
#set -e
6-
7-
# import common functions
8-
source "$(dirname $0)/common-func.sh"
9-
10-
function show_help() {
11-
binName="bash $(basename $0)"
12-
13-
cat <<EOF
14-
Release all sub-repo to new tag version and push to remote repo
15-
16-
Usage:
17-
${binName} [-t VERSION] [NAME ...]
3+
# TODO with release message
184

19-
Options:
20-
-a Release all components
21-
-t <version> Specifies the version number to be published,
22-
without specifying the automatic calculation of the next version.
23-
eg: v2.0.4
24-
-y No confirmation required
25-
-h, --help Display the help information
5+
set -e
266

27-
Example:
28-
${binName} -a Release all components, will auto calc next version
29-
${binName} -t v2.0.4 -a Release all components, use user input version
30-
${binName} -t v2.0.4 event Release one component
31-
${binName} -t v2.0.4 event stdlib Release multi components
7+
binName="bash $(basename $0)"
328

33-
EOF
9+
if [[ -z "$1" ]]
10+
then
11+
echo "Release all sub-repo to new tag version and push to remote repo"
12+
echo -e "Usage:\n $binName VERSION"
13+
echo "Example:"
14+
echo " $binName v1.0.0 Tag for all sub-repos and push to remote repo"
15+
echo " $binName v1.0.0 http-server Tag for one sub-repo and push to remote repo"
3416
exit 0
35-
}
36-
37-
# 显示帮助
38-
[[ "$1" = "" || "$1" = "-h" || "$1" = "--help" ]] && show_help
39-
40-
RELEASE_TAG=AUTO
41-
NEED_CONFIRM=Y
42-
43-
# parse input options
44-
# ref https://www.cnblogs.com/yxzfscg/p/5338775.html
45-
while getopts "t:ahy" arg; do #选项后面的冒号表示该选项需要参数
46-
case ${arg} in
47-
a)
48-
COMPONENTS=$(ls src/) ;;
49-
h)
50-
show_help ;;
51-
y)
52-
NEED_CONFIRM=N ;;
53-
t)
54-
RELEASE_TAG=$OPTARG ;;
55-
?) #当有不认识的选项的时候arg为?
56-
echo "Missing argument"
57-
exit 1
58-
;;
59-
esac
60-
done
61-
62-
shift $(($OPTIND - 1))
17+
fi
6318

19+
RELEASE_TAG=$1
6420
TARGET_BRANCH=master
6521
CURRENT_BRANCH=`git rev-parse --abbrev-ref HEAD`
66-
#CURRENT_BRANCH=master
6722

68-
[[ -n "$@" ]] && COMPONENTS=$@
23+
SUB_REPOS=$2
6924

70-
if [[ -z "${COMPONENTS}" ]]; then
71-
colored_text "Please input want released component names or use option: -a" red
72-
exit 1
25+
if [[ -z "$2" ]]; then
26+
SUB_REPOS=$(ls src/)
7327
fi
7428

7529
echo "Will released version: ${RELEASE_TAG}"
7630
echo "Will released projects:"
77-
echo " " ${COMPONENTS}
78-
#colored_text "${COMPONENTS}"
79-
80-
if [[ "$NEED_CONFIRM" = "Y" ]]; then
81-
if ! user_confirm "Continue"; then
82-
colored_text "Good Bye"
83-
exit 0
84-
fi
85-
fi
86-
87-
TMP_DIR="/tmp/release-components-git"
31+
echo ${SUB_REPOS}
8832

89-
yellow_text "> rm -rf ${TMP_DIR} && mkdir ${TMP_DIR}"
90-
rm -rf ${TMP_DIR} && mkdir ${TMP_DIR};
91-
#pwd
92-
yellow_text "> cp -R $(pwd)/. ${TMP_DIR}"
93-
cp -R $(pwd)/. ${TMP_DIR}
94-
#cd ${TMP_DIR} && git checkout . && pwd;
95-
cd ${TMP_DIR} && git checkout . && pwd;
33+
TMP_DIR="/tmp/swoft-repos"
9634

97-
for LIB_NAME in ${COMPONENTS} ; do
98-
colored_text "\n====== Releasing the component:【${LIB_NAME}" cyan
35+
for LIB_NAME in ${SUB_REPOS} ; do
36+
echo ""
37+
echo "====== Releasing the component:【${LIB_NAME}"
9938

10039
# REMOTE_URL=`git remote get-url ${LIB_NAME}`
101-
# REMOTE_URL="git@github.com:swoft-cloud/swoft-${LIB_NAME}.git"
40+
REMOTE_URL="git@github.com:swoft-cloud/swoft-${LIB_NAME}.git"
10241

103-
colored_text "Check sub-component remote"
104-
yellow_text "> git remote -v | grep ${LIB_NAME}"
105-
REMOTE_INFO=`git remote -v | grep ${LIB_NAME}`
42+
echo "> rm -rf ${TMP_DIR} && mkdir ${TMP_DIR}";
43+
rm -rf ${TMP_DIR} && mkdir ${TMP_DIR};
10644

107-
if [[ -z "$REMOTE_INFO" ]]; then
108-
red_text "Not found remote for the component: ${LIB_NAME}"
109-
continue
110-
fi
45+
(
46+
cd ${TMP_DIR};
47+
echo "Begin clone ${REMOTE_URL} to ${TMP_DIR}"
48+
git clone ${REMOTE_URL} . --depth=200
49+
git checkout ${CURRENT_BRANCH};
11150

112-
yellow_text "> git pull ${LIB_NAME}"
113-
git pull ${LIB_NAME};
51+
# like: v2.0.0
52+
LAST_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))
11453

115-
NEW_BRANCH=${LIB_NAME}-master
54+
if [[ -z "$LAST_RELEASE" ]]; then
55+
echo "There has not been any releases. Releasing $1";
11656

117-
yellow_text "> git checkout -b ${NEW_BRANCH} ${LIB_NAME}/master"
118-
git checkout -b ${NEW_BRANCH} ${LIB_NAME}/master;
119-
120-
yellow_text "> git pull ${LIB_NAME} ${TARGET_BRANCH}"
121-
git pull ${LIB_NAME} ${TARGET_BRANCH};
122-
123-
# like: v2.0.0
124-
LAST_RELEASE=$(git describe --tags $(git rev-list --tags --max-count=1))
125-
126-
# this is first release
127-
if [[ -z "$LAST_RELEASE" ]]; then
128-
if [[ "$RELEASE_TAG" = "AUTO" ]]; then
129-
read -p "Please input release tag version: " RELEASE_TAG
130-
fi
131-
132-
colored_text "There has not been any releases. Releasing $RELEASE_TAG";
133-
else
134-
# auto find next version tag
135-
if [[ "$RELEASE_TAG" = "AUTO" ]]; then
136-
RELEASE_TAG=$(php dtool.php git:tag --only-tag --next-tag ${LAST_RELEASE})
137-
fi
57+
# git tag $1 -s -m "Release $1"
58+
git tag -a $1 -m "Release $1"
59+
git push origin --tags
60+
else
61+
echo "Last release $LAST_RELEASE";
13862

139-
echo "Last release $LAST_RELEASE";
63+
CHANGES_SINCE_LAST_RELEASE=$(git log --oneline --decorate "$LAST_RELEASE"...master)
14064

141-
CHANGES_SINCE_LAST_RELEASE=$(git log --oneline --decorate "$LAST_RELEASE"...master)
65+
if [[ ! -z "$CHANGES_SINCE_LAST_RELEASE" ]]; then
66+
echo "There are changes since last release. Releasing $1";
14267

143-
if [[ ! -z "$CHANGES_SINCE_LAST_RELEASE" ]]; then
144-
colored_text "There are changes since last release. Releasing $RELEASE_TAG";
145-
else
146-
blue_text "No any change since last release. Skip release";
147-
continue
68+
# git tag $1 -s -m "Release $1"
69+
git tag -a $1 -m "Release $1"
70+
git push origin --tags
71+
else
72+
echo "No change since last release.";
73+
fi
14874
fi
149-
fi
150-
151-
# git tag $1 -s -m "Release $RELEASE_TAG"
152-
yellow_text "> git tag -a $1 -m \"Release $RELEASE_TAG\""
153-
git tag -a ${RELEASE_TAG} -m "Release $RELEASE_TAG";
154-
155-
yellow_text "> git push $LIB_NAME origin $RELEASE_TAG"
156-
git push ${LIB_NAME} ${RELEASE_TAG};
75+
)
15776
done
15877

159-
yellow_text "> git checkout ${CURRENT_BRANCH}"
160-
git checkout ${CURRENT_BRANCH}
161-
162-
colored_text "\nRelease Completed!"
78+
echo ""
79+
echo "Completed!"
80+
exit

0 commit comments

Comments
 (0)