Skip to content

Commit e4634d1

Browse files
author
Librazy
committed
auto generate maven repo
1 parent 7176ec1 commit e4634d1

File tree

2 files changed

+38
-3
lines changed

2 files changed

+38
-3
lines changed

.travis.yml

+22-3
Original file line numberDiff line numberDiff line change
@@ -3,29 +3,48 @@ jdk: oraclejdk8
33
branches:
44
except:
55
- "/^*-v[0-9]/"
6+
- "/^*-mc/"
67
- "maven-repo"
78
env:
89
global:
910
- MC_VERSION=1.11.2
1011
- PLUGIN_VERSION=2.0
1112
install: true
1213
before_script:
14+
- git config --global user.email "[email protected]"
15+
- git config --global user.name "Travis CI"
1316
- 'sed -i "s/^\(version: \).*\$/\1$PLUGIN_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION/g" src/main/resources/plugin.yml'
1417
script: gradle build
1518
before_cache:
1619
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
20+
- rm -f $HOME/.gradle/caches/3.5/fileHashes/fileHashes.bin
21+
- rm -f $HOME/.gradle/caches/3.5/fileHashes/fileHashes.lock
22+
- rm -f $HOME/.gradle/caches/transforms-1/transforms-1.lock
1723
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
1824
cache:
1925
directories:
2026
- $HOME/.gradle/caches/
2127
- $HOME/.gradle/wrapper/
2228
before_deploy:
2329
- cp build/libs/NyaaCore.jar ./NyaaCore-$PLUGIN_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION.jar
24-
- git config --global user.email "[email protected]"
25-
- git config --global user.name "Travis CI"
2630
- export GIT_TAG=$PLUGIN_VERSION.$TRAVIS_BUILD_NUMBER-mc$MC_VERSION
31+
- export GIT_ORIGIN_URL=`git config --get remote.origin.url`
2732
- git tag $GIT_TAG -a -m "Generated tag from TravisCI for build $TRAVIS_BUILD_NUMBER"
28-
- git push -q https://RecursiveG:[email protected]/NyaaCat/NyaaCore --follow-tags
33+
- git config credential.helper "store --file=.git/credentials"
34+
- echo "https://$GITHUB_OAUTH_TOKEN:@github.com" > .git/credentials
35+
- git push -q --follow-tags
36+
- gem install octokit -v 4.3.0
37+
- gradle publish
38+
- cd ..
39+
- git clone -b maven-repo $GIT_ORIGIN_URL nyaacore-mvn
40+
- cp -r NyaaCore/build/repo/cat nyaacore-mvn/
41+
- cd nyaacore-mvn
42+
- git config credential.helper "store --file=.git/credentials"
43+
- echo "https://$GITHUB_OAUTH_TOKEN:@github.com" > .git/credentials
44+
- git add .
45+
- git commit -m "auto generated maven repo"
46+
- git push --follow-tags
47+
- cd ../NyaaCore
2948
deploy:
3049
skip_cleanup: true
3150
provider: releases

build.gradle

+16
Original file line numberDiff line numberDiff line change
@@ -50,3 +50,19 @@ dependencies {
5050
compileJava {
5151
options.compilerArgs += ["-Xplugin:NyaaUtilsLangAnnotationProcessor"]
5252
}
53+
54+
publishing {
55+
publications {
56+
mavenJava(MavenPublication) {
57+
groupId "cat.nyaa"
58+
artifactId "nyaacore"
59+
version '2.0-SNAPSHOT'
60+
from components.java
61+
}
62+
}
63+
repositories {
64+
maven {
65+
url "$buildDir/repo"
66+
}
67+
}
68+
}

0 commit comments

Comments
 (0)