|
1 | | -language: java |
2 | | -jdk: oraclejdk8 |
| 1 | +jobs: |
| 2 | + include: |
| 3 | + - stage: main |
| 4 | + language: java |
| 5 | + jdk: oraclejdk8 |
| 6 | + install: true |
| 7 | + before_script: |
| 8 | + - export MAJOR_VERSION=`sed -n 's/^ext\.majorVersion = \(.*\)$/\1/p' build.gradle` |
| 9 | + - export MINOR_VERSION=`sed -n 's/^ext\.minorVersion = \(.*\)$/\1/p' build.gradle` |
| 10 | + - export MC_VERSION=`sed -n 's/^ext\.minecraftVersion = "\(.*\)"$/\1/p' build.gradle` |
| 11 | + - export VERSION_STRING=$MAJOR_VERSION.$MINOR_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION |
| 12 | + - git config --global user.email "[email protected]" |
| 13 | + - git config --global user.name "Travis CI" |
| 14 | + - 'sed -i "s/^\(version: \).*\$/\1$VERSION_STRING/g" src/main/resources/plugin.yml' |
| 15 | + script: gradle build |
| 16 | + after_success: |
| 17 | + - cp build/libs/NyaaUtils.jar ./NyaaUtils-v$VERSION_STRING.jar |
| 18 | + - export GIT_TAG=v$VERSION_STRING |
| 19 | + - git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER" |
| 20 | + - export GIT_ORIGIN_URL=`git config --get remote.origin.url` |
| 21 | + - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi |
| 22 | + - if [ "$TRAVIS_BRANCH" != "master" ]; then exit 0; fi |
| 23 | + - | |
| 24 | + if [ $PUBLISH_MAVEN ]; then |
| 25 | + ./gradlew publish; |
| 26 | + pushd ..; |
| 27 | + git clone -b maven-repo $MAVEN_REPO_URL mvn; |
| 28 | + cp -r NyaaUtils/build/repo/cat mvn/; |
| 29 | + cd mvn; |
| 30 | + git config credential.helper "store --file=.git/credentials"; |
| 31 | + echo "https://$GITHUB_KEY:@github.com" > .git/credentials; |
| 32 | + git add .; |
| 33 | + git commit -m "auto generated maven repo"; |
| 34 | + git push --follow-tags; |
| 35 | + popd; |
| 36 | + fi |
| 37 | + deploy: |
| 38 | + skip_cleanup: true |
| 39 | + provider: releases |
| 40 | + prerelease: true |
| 41 | + api_key: ${GITHUB_DEPLOY_KEY} |
| 42 | + file: ./NyaaUtils-v$VERSION_STRING.jar |
| 43 | + on: |
| 44 | + tags: false |
| 45 | + |
| 46 | + - stage: javadoc |
| 47 | + language: java |
| 48 | + jdk: oraclejdk10 |
| 49 | + script: |
| 50 | + - export MAJOR_VERSION=`sed -n 's/^ext\.majorVersion = \(.*\)$/\1/p' build.gradle` |
| 51 | + - export MINOR_VERSION=`sed -n 's/^ext\.minorVersion = \(.*\)$/\1/p' build.gradle` |
| 52 | + - export MC_VERSION=`sed -n 's/^ext\.minecraftVersion = "\(.*\)"$/\1/p' build.gradle` |
| 53 | + - export VERSION_STRING=$MAJOR_VERSION.$MINOR_VERSION-mc$MC_VERSION |
| 54 | + - if [ "$TRAVIS_PULL_REQUEST" != "false" ]; then exit 0; fi |
| 55 | + - if [ "$TRAVIS_BRANCH" != "master" ]; then exit 0; fi |
| 56 | + - | |
| 57 | + if [ $PUBLISH_JAVADOC ]; then |
| 58 | + ./gradlew javadoc; |
| 59 | + pushd ..; |
| 60 | + git clone -b gh-pages $MAVEN_REPO_URL pages; |
| 61 | + rm -rf pages/NyaaUtils/$VERSION_STRING/; |
| 62 | + mkdir -p pages/NyaaUtils/$VERSION_STRING/; |
| 63 | + cp -r NyaaUtils/build/docs/javadoc pages/NyaaUtils/$VERSION_STRING/; |
| 64 | + cd pages; |
| 65 | + git config credential.helper "store --file=.git/credentials"; |
| 66 | + echo "https://$GITHUB_KEY:@github.com" > .git/credentials; |
| 67 | + git add .; |
| 68 | + git commit -m "auto generated javadoc"; |
| 69 | + git push --follow-tags; |
| 70 | + popd; |
| 71 | + fi |
| 72 | +
|
3 | 73 | branches: |
4 | 74 | except: |
5 | 75 | - "/^*-v[0-9]/" |
6 | 76 | - "/^*-mc/" |
7 | 77 | - "maven-repo" |
8 | 78 | - "maven-repo-dev" |
9 | | -install: true |
10 | | -before_script: |
11 | | -- export MAJOR_VERSION=`sed -n 's/^ext\.majorVersion = \(.*\)$/\1/p' build.gradle` |
12 | | -- export MINOR_VERSION=`sed -n 's/^ext\.minorVersion = \(.*\)$/\1/p' build.gradle` |
13 | | -- export MC_VERSION=`sed -n 's/^ext\.minecraftVersion = "\(.*\)"$/\1/p' build.gradle` |
14 | | -- export VERSION_STRING=$MAJOR_VERSION.$MINOR_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION |
15 | | -- git config --global user.email "[email protected]" |
16 | | -- git config --global user.name "Travis CI" |
17 | | -- 'sed -i "s/^\(version: \).*\$/\1$VERSION_STRING/g" src/main/resources/plugin.yml' |
18 | | -script: gradle build |
19 | | -after_success: |
20 | | -- cp build/libs/NyaaUtils.jar ./NyaaUtils-v$VERSION_STRING.jar |
21 | | -- export GIT_TAG=v$VERSION_STRING |
22 | | -- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER" |
23 | | -- export GIT_ORIGIN_URL=`git config --get remote.origin.url` |
24 | | -- ./gradlew publish |
25 | | -- | |
26 | | - if [ $PUBLISH_MAVEN ]; then |
27 | | - cd ..; |
28 | | - git clone -b maven-repo $MAVEN_REPO_URL mvn; |
29 | | - cp -r NyaaUtils/build/repo/cat mvn/; |
30 | | - cd mvn; |
31 | | - git config credential.helper "store --file=.git/credentials"; |
32 | | - echo "https://$GITHUB_KEY:@github.com" > .git/credentials; |
33 | | - git add .; |
34 | | - git commit -m "auto generated maven repo"; |
35 | | - git push --follow-tags; |
36 | | - fi |
37 | | -- cd ../NyaaUtils |
38 | | -deploy: |
39 | | - skip_cleanup: true |
40 | | - provider: releases |
41 | | - prerelease: true |
42 | | - api_key: ${GITHUB_DEPLOY_KEY} |
43 | | - file: ./NyaaUtils-v$VERSION_STRING.jar |
44 | | - on: |
45 | | - tags: false |
46 | 79 | before_cache: |
47 | 80 | - rm -f $HOME/.gradle/caches/modules-2/modules-2.lock |
48 | 81 | - rm -f $HOME/.gradle/caches/*/fileHashes/fileHashes.bin |
|
0 commit comments