-
Notifications
You must be signed in to change notification settings - Fork 46
/
.travis.yml
136 lines (133 loc) · 5.08 KB
/
.travis.yml
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
130
131
132
133
134
135
136
jobs:
include:
- stage: main
language: java
jdk: openjdk8
install:
- export MAJOR_VERSION=`sed -n 's/^String majorVersion = \(.*\)$/\1/p' build.gradle`
- export MINOR_VERSION=`sed -n 's/^String minorVersion = \(.*\)$/\1/p' build.gradle`
- export MC_VERSION=`sed -n 's/^String minecraftVersion = "\(.*\)"$/\1/p' build.gradle`
- export FULL_VERSION_STRING=$MAJOR_VERSION.$MINOR_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION
- |
if [[ $TRAVIS_COMMIT_MESSAGE == *\[release\]* ]]
then export RELEASING=true
else export RELEASING=false
fi
- |
if [ "$TRAVIS_BRANCH" != "$MC_VERSION" ]; then
export MAIN_BRANCH=false
if ! [[ $RELEASING && $PUBLISH_MAVEN ]]; then exit 0; fi
else
export MAIN_BRANCH=true
fi
- |
if [[ $TRAVIS_COMMIT_MESSAGE == \[\[release\]\]* ]]
then export MAIN_BRANCH=true
fi
- 'sed -i "s/^\(version: \).*\$/\1$FULL_VERSION_STRING/g" src/main/resources/plugin.yml'
- pushd ~/build/
- git clone --depth=1 https://github.com/NyaaCat/NyaaCore NyaaCat/NyaaCore
- export NYAACORE_LANG_DIR=`readlink -f ./NyaaCat/NyaaCore/src/main/resources/lang/`
- popd
script:
- ./gradlew build
after_success:
- if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi
- |
if [ $PUBLISH_MAVEN ]; then
./gradlew publish;
pushd ..;
git clone -b maven-repo $MAVEN_REPO_URL mvn;
cp -r RPGItems-reloaded/build/repo/cat mvn/;
cd mvn;
git config credential.helper "store --file=.git/credentials";
echo "https://$GITHUB_KEY:@github.com" > .git/credentials;
git add .;
git commit -m "auto generated maven repo";
git push --follow-tags;
popd;
fi
- if [ $MAIN_BRANCH ];
then echo "Deploying "$TRAVIS_BRANCH" as main branch";
else exit 0;
fi
- if $RELEASING ; then echo "releasing "$FULL_VERSION_STRING ; else echo "skipping travis deploy" && exit 0 ; fi
- cp build/libs/RPGItems-reloaded-release.jar ./rpgitem-reloaded-$FULL_VERSION_STRING.jar
before_deploy:
- git config --global user.email "builds@travis-ci.com"
- git config --global user.name "Travis CI"
- export GIT_TAG=v$FULL_VERSION_STRING
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
- git config credential.helper "store --file=.git/credentials"
- echo "https://${GITHUB_KEY}:@github.com" > .git/credentials
- git push -q origin HEAD:$TRAVIS_BRANCH --follow-tags || true
deploy:
skip_cleanup: true
provider: releases
prerelease: true
api_key: $GITHUB_KEY
file: './rpgitem-reloaded-$FULL_VERSION_STRING.jar'
body: 'RPGItems build $TRAVIS_BUILD_NUMBER for spigot $TRAVIS_BRANCH'
on:
tags: false
all_branches: true
- stage: javadoc
language: java
jdk: openjdk10
if: type = push
script:
- export MAJOR_VERSION=`sed -n 's/^String majorVersion = \(.*\)$/\1/p' build.gradle`
- export MINOR_VERSION=`sed -n 's/^String minorVersion = \(.*\)$/\1/p' build.gradle`
- export MC_VERSION=`sed -n 's/^String minecraftVersion = "\(.*\)"$/\1/p' build.gradle`
- export VERSION_STRING=$MAJOR_VERSION.$MINOR_VERSION-mc$MC_VERSION
- export FULL_VERSION_STRING=$MAJOR_VERSION.$MINOR_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION
- |
if [ "$TRAVIS_BRANCH" != "$MC_VERSION" ]; then
export MAIN_BRANCH=false
if ! [[ $RELEASING && $PUBLISH_MAVEN ]]; then exit 0; fi
else
export MAIN_BRANCH=true
fi
- |
if [[ $TRAVIS_COMMIT_MESSAGE == \[release\]* ]]
then export RELEASING=true
else export RELEASING=false
fi
- |
if [[ $TRAVIS_COMMIT_MESSAGE == \[\[release\]\]* ]]
then export MAIN_BRANCH=true
fi
- |
if [ $PUBLISH_JAVADOC ]; then
./gradlew javadoc;
pushd ..;
git clone -b gh-pages $MAVEN_REPO_URL pages;
rm -rf pages/RPGItems-reloaded/$VERSION_STRING/;
mkdir -p pages/RPGItems-reloaded/$VERSION_STRING/;
cp -vr RPGItems-reloaded/build/docs/javadoc pages/RPGItems-reloaded/$VERSION_STRING/;
if [[ $RELEASING ]] ; then
mkdir -p pages/RPGItems-reloaded/$FULL_VERSION_STRING/;
cp -vr RPGItems-reloaded/build/docs/javadoc pages/RPGItems-reloaded/$FULL_VERSION_STRING/;
fi;
cd pages;
git config credential.helper "store --file=.git/credentials";
echo "https://$GITHUB_KEY:@github.com" > .git/credentials;
git add .;
git commit -m "auto generated javadoc";
git push --follow-tags;
popd;
fi
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin
- rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.lock
- rm -f $HOME/.gradle/caches/transforms-1/transforms-1.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
- rm -f $HOME/.gradle/caches/*/fileContent/fileContent.lock
cache:
directories:
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
branches:
except:
- "/^*-mc/"