forked from joelittlejohn/jsonschema2pojo
-
Notifications
You must be signed in to change notification settings - Fork 0
/
jsonschema2pojo-upload-release
executable file
·129 lines (103 loc) · 5.02 KB
/
jsonschema2pojo-upload-release
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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#!/bin/bash
#
# Prepares and uploads files for the project downloads area and pushes new docs into the wiki repo.
#
# To create a new release:
#
# 1. Maven release command:
# mvn clean release:clean release:prepare release:perform -DignoreSnapshots -DautoVersionSubmodules
#
# 2. Close and Release snapshots repo at oss.sonatype.org
#
# 3. Wait at least 2hrs for synchronization to central
#
# 4. Run this script to publish new release to googlecode
#
set -e
if [[ ! ("$#" == 3 ) ]]; then
echo 'Usage: upload-release <old version> <new version> <googlecode password>'
exit 1
fi
if [[ "`which googlecode_upload`" == "" ]]; then
echo "Missing required command 'googlecode_upload'"
exit 1
fi
OLD_VERSION=$1
VERSION=$2
PASSWORD=$3
WORKING_DIR=/tmp/jsonschema2pojo-$VERSION
# recreate release dir
rm -rf $WORKING_DIR
mkdir -p $WORKING_DIR
pushd $WORKING_DIR
# download artifacts
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo/$VERSION/jsonschema2pojo-$VERSION-javadoc.jar
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-cli/$VERSION/jsonschema2pojo-cli-$VERSION-sources.jar
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-cli/$VERSION/jsonschema2pojo-cli-$VERSION.jar
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-cli/$VERSION/jsonschema2pojo-cli-$VERSION.bat
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-cli/$VERSION/jsonschema2pojo-cli-$VERSION.sh
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-core/$VERSION/jsonschema2pojo-core-$VERSION-sources.jar
# download dependencies for cli
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-cli/$VERSION/jsonschema2pojo-cli-$VERSION.pom -O pom.xml
mvn dependency:copy-dependencies -DincludeScope=runtime
mv target/lib .
rm -r target pom.xml
# do some shuffling for cleaner script names
mv jsonschema2pojo-cli-$VERSION.bat jsonschema2pojo.bat
mv jsonschema2pojo-cli-$VERSION.sh jsonschema2pojo
chmod +x jsonschema2pojo
# create the release archives
pushd ..
tar czf jsonschema2pojo-$VERSION.tar.gz jsonschema2pojo-$VERSION
zip --recurse-paths jsonschema2pojo-$VERSION.zip jsonschema2pojo-$VERSION
popd
# checkout wiki to update & add docs
git clone https://code.google.com/p/jsonschema2pojo.wiki/ wiki
pushd wiki
# extract javadocs to wiki
mkdir -p javadocs/$VERSION
unzip $WORKING_DIR/jsonschema2pojo-$VERSION-javadoc.jar -d javadocs/$VERSION/
# commit javadocs and push to main repo
git add .
git commit -m "[release] adding $VERSION javadocs"
git push
popd
wget -U NoSuchBrowser/1.0 http://repo1.maven.org/maven2/org/jsonschema2pojo/jsonschema2pojo-maven-plugin/$VERSION/jsonschema2pojo-maven-plugin-$VERSION-site.jar
pushd wiki
# extract plugin docs
mkdir -p site/$VERSION
unzip $WORKING_DIR/jsonschema2pojo-maven-plugin-$VERSION-site.jar -d site/$VERSION/
# commit plugin docs and push to main repo
git add .
git commit -m "[release] adding $VERSION plugin docs"
git push
popd
pushd wiki
# replace any references to old version with new version
sed -i "s/$OLD_VERSION/$VERSION/g" *.wiki
# commit wiki updates and push to main repo
git add .
git commit -m "[release] updating wiki links and examples to $VERSION"
git push
# update example
wget http://jsonschema2pojo.googlecode.com/git-history/jsonschema2pojo-$VERSION/jsonschema2pojo-core/src/test/java/org/jsonschema2pojo/example/Example.java
sed '/BEGIN EXAMPLE/q' GettingStarted.wiki > GettingStarted.wiki.new
echo '{{{' >> GettingStarted.wiki.new
sed '1,/BEGIN EXAMPLE/d;/END EXAMPLE/,$d;s/ //g' Example.java >> GettingStarted.wiki.new
echo '}}}' >> GettingStarted.wiki.new
sed -n '/END EXAMPLE/,$p' GettingStarted.wiki >> GettingStarted.wiki.new
mv GettingStarted.wiki.new GettingStarted.wiki
rm Example.java
# commit wiki updates and push to main repo
git add .
git commit -m "[release] updating example code to $VERSION" || true
git push || true
popd
# upload to google code
googlecode_upload -s "$VERSION binaries, sources, javadocs, dependencies" -p jsonschema2pojo -u joelittlejohn@gmail.com -w $PASSWORD -l Featured ../jsonschema2pojo-$VERSION.tar.gz
googlecode_upload -s "$VERSION binaries, sources, javadocs, dependencies" -p jsonschema2pojo -u joelittlejohn@gmail.com -w $PASSWORD -l Featured ../jsonschema2pojo-$VERSION.zip
popd
rm -rf $WORKING_DIR
echo Release complete. Next steps:
echo - Remove \'Featured\' label from older downloads
echo - Replace $OLD_VERSION with $VERSION in all text and links on project homepage