-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·89 lines (68 loc) · 1.98 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·89 lines (68 loc) · 1.98 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#!/bin/env bash
set -e
VERSION="$1"
CURRENT_VERSION=$(wget -qO- https://raw.githubusercontent.com/DeSmart/dekick/main/.version)
BOILERPLATES_DIR=boilerplates/
if [ -z "$VERSION" ]; then
echo "Usage: $0 <version>"
exit 1
fi
if [[ $(echo -e "$VERSION\n$CURRENT_VERSION" | sort -Vr | head -n 1) != "$VERSION" ]] || [ "$VERSION" = "$CURRENT_VERSION" ]; then
echo "Error: VERSION must be greater than CURRENT_VERSION"
exit 1
fi
git flow init -d
echo "Releasing version $VERSION"
read -p "Continue? (y/n) " -n 1 -r
if [[ $REPLY =~ ^[Nn]$ ]]; then
exit 1
fi
echo "Releasing boilerplates"
cd "$BOILERPLATES_DIR" || exit 1
git flow release start "${VERSION}"
git flow release finish "${VERSION}" -m "chore: tag"
git push --tags
git push --all
cd - || exit 1
echo "Releasing DeKick"
git flow release start "${VERSION}"
echo "Saving version to .version"
echo -n "$VERSION" > .version
git add .version
git commit -m "chore: new version"
echo "Changing README.md"
sed -i "s/version-develop-teal/version-$VERSION-teal/g" README.md || true
sed -i "s/\[version-develop\]/[version-$VERSION]/g" README.md || true
git add README.md || true
git commit -m "docs: update" || true
echo "Creating Docker images"
cd docker || exit 1
./create-dekick-dind-image.sh
./create-dekick-image.sh
cd - || exit 1
git checkout .
git checkout main
git pull
git checkout "release/${VERSION}"
git flow release finish "${VERSION}" -m "chore: tag"
git push --tags
git push --all
echo "Version released!"
echo "Switching back to develop branch"
git checkout develop
echo -n "develop" > .version
git add .version
git commit -m "chore: new version"
echo "Changing README.md"
sed -i "s/version-$VERSION-teal/version-develop-teal/g" README.md
sed -i "s/\[version-$VERSION\]/[version-develop]/g" README.md
git add README.md
git commit -m "docs: update"
echo "Creating Docker images"
cd docker || exit 1
./create-dekick-dind-image.sh
./create-dekick-image.sh
cd - || exit 1
git push --tags
git push --all
echo "Version $VERSION released!"