Skip to content

Commit 47da935

Browse files
committed
add release helper script
1 parent 0c4972a commit 47da935

5 files changed

Lines changed: 73 additions & 4 deletions

File tree

.dockerignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
.git/
22
LICENSE
3-
README.md
3+
README.md
4+
release.sh

Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
FROM sinusbot/docker:discord
1+
FROM sinusbot/docker:1.0.0-beta.6-f290553-discord
22

33
LABEL maintainer="Max Schmitt <max@schmitt.mx>"
44
LABEL description="SinusBot - TeamSpeak 3 and Discord music bot."
5+
LABEL version="1.0.0-beta.6-f290553"
56

67
# Install dependencies and clean up afterwards
78
RUN apt-get update && \

discord/Dockerfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ FROM debian:stretch-slim
22

33
LABEL maintainer="Max Schmitt <max@schmitt.mx>"
44
LABEL description="SinusBot - Discord only image"
5+
LABEL version="1.0.0-beta.6-f290553"
56

67
# Install dependencies and clean up afterwards
78
RUN apt-get update && \

discord/install.sh

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

33
set -e
44

5+
SINUSBOT_VERSION="1.0.0-beta.6-f290553"
6+
57
case "$1" in
68

79
"sinusbot")
810
echo "Downloading SinusBot..."
9-
VERSION="1.0.0-beta.6-f290553"
10-
curl -s "https://www.sinusbot.com/pre/sinusbot-$VERSION.tar.bz2" | tar xj
11+
curl -s "https://www.sinusbot.com/pre/sinusbot-$SINUSBOT_VERSION.tar.bz2" | tar xj
1112
chmod 755 sinusbot
1213
mv scripts default_scripts
1314
ln -s data/private.dat private.dat

release.sh

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
#!/bin/bash
2+
3+
set -ex
4+
5+
VERSION="$1"
6+
7+
if [[ -z "$VERSION" ]]; then
8+
echo "Usage: ./release.sh <version>"
9+
exit 1
10+
fi
11+
12+
echo "Version: $VERSION"
13+
14+
IMAGE=sinusbot/docker
15+
16+
read -p "Pull from git? [Y/n] " -n 1 -r
17+
echo
18+
if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then
19+
git pull
20+
fi
21+
22+
echo "Replacing version in files..."
23+
sed -i "s|^SINUSBOT_VERSION=.*|SINUSBOT_VERSION=\"$VERSION\"|g" discord/install.sh
24+
sed -i "s|^LABEL version.*|LABEL version=\"$VERSION\"|g" discord/Dockerfile
25+
sed -i "s|^FROM sinusbot.*|FROM sinusbot/docker:$VERSION-discord|g" Dockerfile
26+
sed -i "s|^LABEL version.*|LABEL version=\"$VERSION\"|g" Dockerfile
27+
28+
read -p "Show diff? [y/N] " -n 1 -r
29+
echo
30+
if [[ $REPLY =~ ^([Yy]) ]]; then
31+
git diff
32+
fi
33+
34+
read -p "Commit changes? [Y/n] " -n 1 -r
35+
echo
36+
if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then
37+
git add -A
38+
git commit -m "v$VERSION"
39+
git tag -a "v$VERSION" -m "v$VERSION"
40+
fi
41+
42+
read -p "Push to git? [Y/n] " -n 1 -r
43+
echo
44+
if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then
45+
git push
46+
git push --tags
47+
fi
48+
49+
read -p "Build images? [Y/n] " -n 1 -r
50+
echo
51+
if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then
52+
docker build -t "$IMAGE":discord discord
53+
docker tag "$IMAGE":discord "$IMAGE":"$VERSION"-discord
54+
docker build -t "$IMAGE":latest .
55+
docker tag "$IMAGE":latest "$IMAGE":"$VERSION"
56+
57+
read -p "Push the builds to docker? (requires docker login) [Y/n] " -n 1 -r
58+
echo
59+
if [[ $REPLY =~ ^([Yy]| ) ]] || [[ -z $REPLY ]]; then
60+
docker push "$IMAGE":"$VERSION"-discord
61+
docker push "$IMAGE":discord
62+
docker push "$IMAGE":"$VERSION"
63+
docker push "$IMAGE":latest
64+
fi
65+
fi

0 commit comments

Comments
 (0)