forked from tony19/logback-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrelease.sh
More file actions
executable file
·108 lines (95 loc) · 3.24 KB
/
Copy pathrelease.sh
File metadata and controls
executable file
·108 lines (95 loc) · 3.24 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
#!/bin/sh
##############################################################################
# Logback: the reliable, generic, fast and flexible logging framework.
# Copyright (C) 2011-2012, Anthony Trinh. All rights reserved.
# Copyright (C) 1999-2011, QOS.ch. All rights reserved.
#
# This program and the accompanying materials are dual-licensed under
# either the terms of the Eclipse Public License v1.0 as published by
# the Eclipse Foundation
#
# or (per the licensee's choosing)
#
# under the terms of the GNU Lesser General Public License version 2.1
# as published by the Free Software Foundation.
##############################################################################
# This script performs a logback-android release:
# * sets the version (removes SNAPSHOT suffix from current version,
# and bumps to the next SNAPSHOT version when release is finished)
# * tags the source in GitHub (e.g., with "v_1.0.2")
# * deploys the signed jars to Sonatype
# * updates the README.md with the current version info
# * updates GitHub pages with javadocs and current version info
# * generates the javadoc and uploads it to GitHub pages
#
# To run this script, simply run:
# $ ./release.sh
#
# For a dryrun, enter:
# $ ./release.sh dryrun
#
# Release version "x.x.x-N"
#
# where
# x.x.x is the version of logback on which logback-android is based
# and
# N is the integral release number of logback-android.
#
version=$(mvn help:evaluate -Dexpression=project.version | grep '^[^[]')
version=${version%-SNAPSHOT}
outf=logback-android-${version}.jar
outdir=$PWD/target
readme=$PWD/README.md
if [ "x$1" == "xdryrun" ]; then
echo "[dryrun] just a test!"
dryrun=true
fi
echo "Starting release process for logback-android ${version}..."
#
# Build the JAR and print its MD5. The last line uses GNU sed (gsed)
# to update the README with the current release version.
#
if [ ! ${dryrun} ]; then
mvn release:clean || exit 1
mvn -Dtag=v_${version} release:prepare || exit 1
mvn -Dtag=v_${version} release:perform || exit 1
else
echo '[dryrun] skip mvn release...'
fi
mvn versions:set -DnewVersion=${version}
mvn clean install -DskipTests
mvn -f pom-uber.xml package -DskipTests -Dmy.project.version=${version}
md5 ${outdir}/${outf} && \
echo "Updating README.md..." && \
gsed -i -e "s/logback-android-[^j]*\.jar/${outf}/" \
-e "s/[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+/${version}/" \
-e "s/\(logback-android.*SHA1\:\).*/\1 \`$(openssl dgst -sha1 ${outdir}/${outf} | awk '{print $2}')\`)/" ${readme}
if [ ! ${dryrun} ]; then
git add ${readme}
git commit -m "Update README for release ${version}"
else
echo '[dryrun] skip commit README...'
fi
echo "Generating javadoc..."
mvn javadoc:javadoc
# Update the web pages
git clone -b gh-pages https://github.com/tony19/logback-android.git gh-pages
cd gh-pages
rm -rf doc/${version}
mv ${outdir}/site/apidocs doc/${version}
echo "Updating index.html..."
gsed -i -e "s/logback-android-[^j]*\.jar/${outf}/g" \
-e "s/[0-9]\+\.[0-9]\+\.[0-9]\+-[0-9]\+/${version}/g" index.html
if [ ! ${dryrun} ]; then
git add index.html
git add doc/${version}
# checkin changes to the web pages
git commit -m "release ${version}"
else
echo '[dryrun] skip commit gh-pages...'
fi
if [ ! ${dryrun} ]; then
echo Done. Push changes to GitHub!!
else
echo Done...just a dryrun!!
fi