Skip to content

Commit 3a09b7e

Browse files
committed
Refine focal script.
1 parent f17f696 commit 3a09b7e

File tree

4 files changed

+90
-21
lines changed

4 files changed

+90
-21
lines changed

README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,6 @@ Release bugfix:
393393
394394
Release version for BT and aaPanel:
395395

396-
* MUST update the version manually in `auto/bt_aapanel_pub.sh`
397396
* Then run `./auto/bt_aapanel_pub.sh`
398397
* Finally, download [bt-srs_cloud.zip](https://github.com/ossrs/srs-cloud/releases) then submit to [bt.cn](https://www.bt.cn/developer/details.html?id=600801805)
399398

auto/bt_aapanel_pub.sh

Lines changed: 68 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,86 @@
22

33
REALPATH=$(realpath $0)
44
WORK_DIR=$(cd $(dirname $REALPATH)/.. && pwd)
5+
echo "Run pub at $WORK_DIR from $0"
56
cd $WORK_DIR
67

7-
# Please update the release version for each major version.
8-
TAG=publication-v4.6.16
9-
echo "Publication TAG=$TAG, WORK_DIR=$WORK_DIR"
8+
help=false
9+
refresh=false
1010

11-
RELEASE=$(git describe --tags --abbrev=0 --match publication-*)
12-
if [[ $TAG == $RELEASE ]]; then
13-
echo "Failed: Release $TAG already published."
14-
echo "Please update the TAG in $0 then run again.";
15-
exit 1
11+
while [[ "$#" -gt 0 ]]; do
12+
case $1 in
13+
-h|--help) help=true; shift ;;
14+
-refresh|--refresh) refresh=true; shift ;;
15+
*) echo "Unknown parameter passed: $1"; exit 1 ;;
16+
esac
17+
done
18+
19+
if [ "$help" = true ]; then
20+
echo "Usage: $0 [OPTIONS]"
21+
echo "Options:"
22+
echo " -h, --help Show this help message and exit"
23+
echo " -refresh, --refresh Refresh current tag. Default: false"
24+
exit 0
25+
fi
26+
27+
# We increase version from the publication-v* base.
28+
RELEASE=$(git describe --tags --abbrev=0 --match publication-v*) &&
29+
REVISION=$(echo $RELEASE|awk -F . '{print $3}')
30+
if [[ $? -ne 0 ]]; then echo "Release failed"; exit 1; fi
31+
32+
let NEXT=$REVISION+1
33+
if [[ $refresh == true ]]; then
34+
let NEXT=$REVISION
1635
fi
36+
echo "Last release is $RELEASE, revision is $REVISION, next is $NEXT"
37+
38+
VERSION="4.6.$NEXT" &&
39+
TAG="publication-v$VERSION" &&
40+
echo "publish version $VERSION as tag $TAG"
41+
if [[ $? -ne 0 ]]; then echo "Release failed"; exit 1; fi
1742

18-
VERSION=$(echo $TAG| sed 's/publication-v//g')
19-
cat scripts/setup-aapanel/info.json |sed "s|\"versions\": .*|\"versions\": \"$VERSION\",|g" > tmp.json && mv tmp.json scripts/setup-aapanel/info.json &&
20-
cat scripts/setup-bt/info.json |sed "s|\"versions\": .*|\"versions\": \"$VERSION\",|g" > tmp.json && mv tmp.json scripts/setup-bt/info.json
43+
######################################################################
44+
if [[ $(grep versions scripts/setup-aapanel/info.json | grep -q $VERSION || echo no) == no ]]; then
45+
echo "Failed: Please update scripts/setup-aapanel/info.json to $VERSION"
46+
echo " sed -i '' 's|\"versions\": \".*\"|\"versions\": \"$VERSION\"|g' scripts/setup-aapanel/info.json"
47+
exit 1
48+
fi
49+
if [[ $(grep versions scripts/setup-bt/info.json | grep -q $VERSION || echo no) == no ]]; then
50+
echo "Failed: Please update scripts/setup-bt/info.json to $VERSION"
51+
echo " sed -i '' 's|\"versions\": \".*\"|\"versions\": \"$VERSION\"|g' scripts/setup-bt/info.json"
52+
exit 1
53+
fi
2154

2255
git st |grep -q 'nothing to commit'
2356
if [[ $? -ne 0 ]]; then
2457
echo "Failed: Please commit before release";
2558
exit 1
2659
fi
2760

28-
git tag -d $TAG 2>/dev/null
29-
git push origin :$TAG 2>/dev/null
30-
git push gitee :$TAG 2>/dev/null
31-
git tag $TAG
32-
git push origin $TAG
33-
git push gitee $TAG
61+
git fetch origin
62+
if [[ $(git status |grep -q 'Your branch is up to date' || echo 'no') == no ]]; then
63+
git status
64+
echo "Failed: Please sync before release";
65+
exit 1
66+
fi
67+
echo "Sync OK"
68+
69+
git fetch gitee
70+
if [[ $(git diff origin/main gitee/main |grep -q diff && echo no) == no ]]; then
71+
git diff origin/main gitee/main |grep diff
72+
echo "Failed: Please sync gitee before release";
73+
exit 1
74+
fi
75+
echo "Sync gitee OK"
76+
77+
######################################################################
78+
git tag -d $TAG 2>/dev/null; git push origin :$TAG 2>/dev/null; git push gitee :$TAG 2>/dev/null
79+
echo "Delete tag OK: $TAG"
80+
81+
git tag $TAG && git push origin $TAG && git push gitee $TAG
82+
echo "Publish OK: $TAG"
83+
84+
echo -e "\n\n"
3485
echo "Publication ok, please visit"
3586
echo " Please test it after https://github.com/ossrs/srs-cloud/actions/workflows/publication.yml done"
3687
echo " Download bt-srs_cloud.zip from https://github.com/ossrs/srs-cloud/releases"

auto/focal_pub.sh

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,17 +30,34 @@ VERSION="1.0.$NEXT"
3030
TAG="focal-v$VERSION"
3131
echo "publish version $VERSION as tag $TAG"
3232

33+
######################################################################
3334
git st |grep -q 'nothing to commit'
3435
if [[ $? -ne 0 ]]; then
3536
echo "Failed: Please commit before release";
3637
exit 1
3738
fi
3839

40+
git fetch origin
41+
if [[ $(git status |grep -q 'Your branch is up to date' || echo 'no') == no ]]; then
42+
git status
43+
echo "Failed: Please sync before release";
44+
exit 1
45+
fi
46+
echo "Sync OK"
47+
48+
git fetch gitee
49+
if [[ $(git diff origin/main gitee/main |grep -q diff && echo no) == no ]]; then
50+
git diff origin/main gitee/main |grep diff
51+
echo "Failed: Please sync gitee before release";
52+
exit 1
53+
fi
54+
echo "Sync gitee OK"
55+
3956
######################################################################
4057
git tag -d $TAG 2>/dev/null; git push origin :$TAG 2>/dev/null; git push gitee :$TAG 2>/dev/null
4158
echo "Delete tag OK: $TAG"
4259

43-
git tag $TAG && git push origin $TAG && git push gitee
60+
git tag $TAG && git push origin $TAG && git push gitee $TAG
4461
echo "Publish OK: $TAG"
4562

4663
echo "publish $TAG ok"

auto/mgmt_platform_pub.sh

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,12 @@ if [[ $? -ne 0 ]]; then echo "Release failed"; exit 1; fi
4343
######################################################################
4444
if [[ $(grep -q "const version = \"$TAG\"" mgmt/version.go || echo no) == no ]]; then
4545
echo "Failed: Please update mgmt/version.go to $TAG"
46+
echo " sed -i '' 's|const version = \".*\"|const version = \"$TAG\"|g' mgmt/version.go"
4647
exit 1
4748
fi
4849
if [[ $(grep -q "const version = \"$TAG\"" platform/version.go || echo no) == no ]]; then
4950
echo "Failed: Please update platform/version.go to $TAG"
51+
echo " sed -i '' 's|const version = \".*\"|const version = \"$TAG\"|g' platform/version.go"
5052
exit 1
5153
fi
5254

@@ -76,7 +78,7 @@ echo "Sync gitee OK"
7678
git tag -d $TAG 2>/dev/null; git push origin :$TAG 2>/dev/null; git push gitee :$TAG 2>/dev/null
7779
echo "Delete tag OK: $TAG"
7880

79-
git tag $TAG && git push origin $TAG && git push gitee
81+
git tag $TAG && git push origin $TAG && git push gitee $TAG
8082
echo "Publish OK: $TAG"
8183

8284
######################################################################
@@ -85,7 +87,7 @@ PLATFORM_TAG="platform-v$VERSION"
8587
git tag -d $PLATFORM_TAG 2>/dev/null; git push origin :$PLATFORM_TAG 2>/dev/null; git push gitee :$PLATFORM_TAG 2>/dev/null
8688
echo "Delete tag OK: $PLATFORM_TAG"
8789

88-
git tag $PLATFORM_TAG && git push origin $PLATFORM_TAG && git push gitee
90+
git tag $PLATFORM_TAG && git push origin $PLATFORM_TAG && git push gitee $PLATFORM_TAG
8991
echo "Publish OK: $PLATFORM_TAG"
9092

9193
echo -e "\n\n"

0 commit comments

Comments
 (0)