-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathprepare-release.sh
executable file
·84 lines (69 loc) · 3.15 KB
/
prepare-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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#!/bin/bash
set -e
# Check parameters
if [ $# != 4 ]
then
echo You must provide the product version, milestone, notes, git \(e.g. \"prepare-release.sh 3.3.0.0 \"https://github\" \"https://github\" \"Some notes\" false\"\)
exit -1
fi
VERSION=$1
MILESTONE=$2
NOTES=$3
PUSH=$4
BUILD_DIR="./build"
echo ""
echo "===="
echo "==== JDK used: " $JAVA_HOME
echo "===="
echo ::: Prepare splash :::
java -jar $BUILD_DIR/ImageLabeler-2.0.jar $VERSION 462 43 $BUILD_DIR/splash-template.bmp plugins/se.ess.ics.csstudio.product/splash.bmp "European Spallation Source Edition" 19 151 plugins/se.ess.ics.csstudio.startup.intro/icons/ess96.png 366 140
echo ::: Change about dialog version :::
echo 0=$VERSION > plugins/se.ess.ics.csstudio.product/about.mappings
echo ::: Change Ansible reference file :::
echo $VERSION > features/org.csstudio.ess.product.configuration.feature/rootfiles/ess-version.txt
echo ::: Updating plugin versions :::
mvn -Dtycho.mode=maven org.eclipse.tycho:tycho-versions-plugin:1.0.0:set-version -DnewVersion=$VERSION -Dartifacts=se.ess.ics.csstudio,se.ess.ics.csstudio.features,org.csstudio.ess.product.configuration.feature,org.csstudio.ess.product.core.feature,org.csstudio.ess.product.eclipse.feature,se.ess.ics.csstudio.plugins,se.ess.ics.csstudio.display.builder,se.ess.ics.csstudio.fonts,se.ess.ics.csstudio.product,se.ess.ics.csstudio.startup.intro,se.ess.ics.csstudio.repository
# update product because set-version doesn't
echo ::: Updating product versions in product files :::
sed -i '' -e 's/\(<product[^>]* version="\)[^"]*\("[^>]*>\)/\1'${VERSION}'\2/g' repository/alarm-config.product
sed -i '' -e 's/\(<product[^>]* version="\)[^"]*\("[^>]*>\)/\1'${VERSION}'\2/g' repository/alarm-notifier.product
sed -i '' -e 's/\(<product[^>]* version="\)[^"]*\("[^>]*>\)/\1'${VERSION}'\2/g' repository/alarm-server.product
sed -i '' -e 's/\(<product[^>]* version="\)[^"]*\("[^>]*>\)/\1'${VERSION}'\2/g' repository/cs-studio-ess.product
sed -i '' -e 's/\(<product[^>]* version="\)[^"]*\("[^>]*>\)/\1'${VERSION}'\2/g' repository/jms2rdb.product
echo ::: Updating product versions in master POM file :::
sed -i '' -e 's/\(<product\.version>\)[^<]*\(\<\/product\.version>\)/\1'${VERSION}'\2/g' pom.xml
HTML="<h2>Version ${VERSION} - $(date +"%Y-%m-%d")</h2><ul>"
if [ -n "${NOTES}" ];
then
HTML="${HTML}<li>${NOTES}</li>";
fi
HTML="${HTML}<li><a href=\"${MILESTONE}\" shape=\"rect\">Closed Issues</a></li></ul>"
# html encode &
HTML=$(echo $HTML | sed 's/&/\&/g;')
# escape all backslashes first
HTML="${HTML//\\/\\\\}"
# escape slashes
HTML="${HTML//\//\\/}"
# escape asterisks
HTML="${HTML//\*/\\*}"
# escape full stops
HTML="${HTML//./\\.}"
# escape [ and ]
HTML="${HTML//\[/\\[}"
HTML="${HTML//\]/\\]}"
# escape ^ and $
HTML="${HTML//^/\\^}"
HTML="${HTML//\$/\\\$}"
# remove newlines
HTML="${HTML//[$'\n']/}"
sed -i '' -e '/<\/p>/ a\
'"${HTML}" plugins/se.ess.ics.csstudio.startup.intro/html/changelog.html
if [ "$PUSH" = "true" ]
then
echo ::: Committing version $VERSION and pushing :::
git commit -a -m "Updating changelog, splash, manifests to version $VERSION"
git push origin
echo ::: Tagging version $VERSION :::
git tag ESS-CSS-$VERSION
git push origin ESS-CSS-$VERSION
fi