-
Notifications
You must be signed in to change notification settings - Fork 65
/
release.sh
executable file
·67 lines (54 loc) · 2.05 KB
/
release.sh
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
#!/bin/bash
# release.sh
# This scripts can be used to execute all tasks required for releasing a new version of the project.
set -e
BASEDIR=$(dirname "$(readlink -f $0)")
DOC_BASEDIR="$BASEDIR/docs/content/en/docs"
GIT_COMMITTER_NAME="Release"
GIT_COMMITTER_EMAIL="release@release"
./mvnw -B -q versions:set -DremoveSnapshot -DgenerateBackupPoms=false >/dev/null 2>&1
RELEASE_VERSION=$(./mvnw org.apache.maven.plugins:maven-help-plugin:3.1.0:evaluate -Dexpression=project.version -q -DforceStdout)
RELEASE_DOC_VERSION=$(echo "$RELEASE_VERSION" | sed 's/\([0-9]\)\s*$/\x/')
RELEASE_DOC_DIR="$DOC_BASEDIR/Archives/v$RELEASE_DOC_VERSION"
RELEASE_DOC_LINK=$(echo "$RELEASE_VERSION" | sed -r 's/\.+/-/g')
RELEASE_DOC_LINK=${RELEASE_DOC_LINK%??}
git pull --rebase
echo "Packaging project: $RELEASE_VERSION"
./mvnw -B -q clean package >/dev/null 2>&1
DIRS=(
"Developer Guide"
"Examples"
"FAQ"
"Getting started"
"Overview"
"Project Info"
)
echo "Creating release site documentation: v$RELEASE_DOC_VERSION"
mkdir -p "$RELEASE_DOC_DIR"
for DIR in "${DIRS[@]}"; do
echo "Copying $DIR to $DOC_BASEDIR/$DIR";
cp -r "$DOC_BASEDIR/$DIR" "$RELEASE_DOC_DIR";
done
echo "Creating $RELEASE_DOC_DIR/_index.md"
cat > "$RELEASE_DOC_DIR/_index.md" <<EOF
---
title: "Docs Release v$RELEASE_DOC_VERSION"
linkTitle: "v$RELEASE_DOC_VERSION"
url: "/v$RELEASE_DOC_LINK/docs"
---
This section is where the user documentation for Connect File Pulse lives - all the information that users need to understand and successfully use Connect File Pulse.
EOF
echo "Updating $BASEDIR/docs/config.toml"
cat >> "$BASEDIR/docs/config.toml" <<EOF
[[params.versions]]
version = "v$RELEASE_DOC_VERSION"
url = "/kafka-connect-file-pulse/v$RELEASE_DOC_LINK/docs"
EOF
git add "$BASEDIR/docs/*" "pom.xml" "*/pom.xml" "*/*/pom.xml"
git commit -m "release version $RELEASE_VERSION" --author="$GIT_COMMITTER_NAME <$GIT_COMMITTER_EMAIL>"
git tag -a "v$RELEASE_VERSION" -m"release v$RELEASE_VERSION"
git branch "$RELEASE_DOC_VERSION"
git push
git push origin "v$RELEASE_VERSION"
git push origin "$RELEASE_DOC_VERSION"
exit 0