-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
/
xtr_releasenotes-gen.sh
executable file
·79 lines (73 loc) · 2.29 KB
/
xtr_releasenotes-gen.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
#!/bin/bash
# Attention, there is no "-x" to avoid problem on Travis
# to run on local:
# export READ_ONLY_TOKEN=9ffd28f
# && export TRAVIS_PULL_REQUEST="master" && ./.ci/travis/travis.sh releasenotes-gen
set -e
echo "TRAVIS_PULL_REQUEST:"$TRAVIS_PULL_REQUEST
if [[ $TRAVIS_PULL_REQUEST =~ ^([0-9]*)$ ]]; then
echo "Build is not for Pull Request";
sleep 5;
exit 0;
fi
mkdir -p .ci-temp
if [ -d .ci-temp/contribution ]; then
cd .ci-temp/contribution/
git reset --hard origin/master
git pull origin master
git fetch --tags
cd ../../
else
cd .ci-temp/
git clone https://github.com/checkstyle/contribution
cd ../
fi
cd .ci-temp/contribution/releasenotes-builder
mvn -e clean compile package
cd ../../../
# we need to do full clone as Travis do "git clone --depth=50"
if [ -d .ci-temp/checkstyle ]; then
cd .ci-temp/checkstyle/
git reset --hard origin/master
git pull origin master
git fetch --tags
cd ../../
else
cd .ci-temp/
git clone https://github.com/checkstyle/checkstyle
cd ../
fi
cd .ci-temp/checkstyle
LATEST_RELEASE_TAG=$(git describe $(git rev-list --tags --max-count=1))
cd ../../
CS_RELEASE_VERSION=$(mvn -e -q -Dexec.executable='echo' -Dexec.args='${project.version}' \
--non-recursive org.codehaus.mojo:exec-maven-plugin:1.3.1:exec | sed 's/-SNAPSHOT//' )
echo LATEST_RELEASE_TAG=$LATEST_RELEASE_TAG
echo CS_RELEASE_VERSION=$CS_RELEASE_VERSION
cd .ci-temp
java -jar contribution/releasenotes-builder/target/releasenotes-builder-1.0-all.jar \
-localRepoPath checkstyle -remoteRepoPath checkstyle/checkstyle \
-startRef $LATEST_RELEASE_TAG -releaseNumber $CS_RELEASE_VERSION \
-githubAuthToken $READ_ONLY_TOKEN -generateAll -publishXdoc
echo ==============================================
echo
echo "xdoc segment:"
echo ==============================================
cat xdoc.xml
echo ==============================================
echo
echo "twitter post:"
echo ==============================================
cat twitter.txt
echo ==============================================
echo
echo "Plain text post:"
echo ==============================================
cat mailing_list.txt
echo ==============================================
cd checkstyle/src/xdocs
echo
echo "releasenotes.xml after commit:"
head -n 100 releasenotes.xml
cd ../../..
find . -delete