Skip to content

Commit 17d5de6

Browse files
kimbleKim A. Betti
authored andcommitted
New Gradle version and yml for package publishing (#3)
1 parent 14ae83d commit 17d5de6

7 files changed

Lines changed: 67 additions & 67 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
name: Java CI
2-
32
on: [push]
43

54
jobs:
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
name: Publish release
2+
3+
on:
4+
release:
5+
types: [published]
6+
7+
jobs:
8+
publish-release:
9+
runs-on: ubuntu-latest
10+
11+
steps:
12+
- name: Checkout latest code
13+
uses: actions/checkout@v2
14+
15+
- name: Set up JDK 13
16+
uses: actions/setup-java@v1
17+
with:
18+
java-version: 13
19+
20+
- name: Setup build cache
21+
uses: actions/cache@v1
22+
with:
23+
path: ~/.gradle/caches
24+
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
25+
restore-keys: |
26+
${{ runner.os }}-gradle-
27+
- name: Publish artifact
28+
env:
29+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
30+
31+
# The GITHUB_REF tag comes in the format 'refs/tags/xxx'.
32+
# So if we split on '/' and take the 3rd value, we can get the release name.
33+
run: |
34+
NEW_VERSION=$(echo "${GITHUB_REF}" | cut -d "/" -f3)
35+
echo "New version: ${NEW_VERSION}"
36+
echo "Github username: ${GITHUB_ACTOR}"
37+
./gradlew -Pversion=${NEW_VERSION} publish

build.gradle

Lines changed: 14 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ buildscript {
88
}
99
}
1010

11-
apply plugin: "com.jfrog.bintray"
1211
apply plugin: "maven-publish"
1312
apply plugin: "java"
1413

@@ -17,7 +16,7 @@ apply plugin: 'com.github.kt3k.coveralls'
1716

1817

1918

20-
group = 'com.developerb.nmxlp' // Yeah I know about the typo, but hard to change now that it's in JCenter..
19+
group = 'com.developerb.nmxmlp'
2120
version = '1.4.1'
2221

2322
compileJava {
@@ -62,8 +61,8 @@ jacocoTestReport {
6261
dependencies {
6362
implementation 'com.google.guava:guava:28.0-jre'
6463

65-
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.5.2'
66-
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.5.2'
64+
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
65+
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.0'
6766
testImplementation 'org.assertj:assertj-core:3.13.2'
6867
}
6968

@@ -81,55 +80,22 @@ test {
8180
useJUnitPlatform()
8281
}
8382

84-
artifacts {
85-
archives sourcesJar, javadocJar
86-
}
8783

88-
publishing {
89-
publications {
90-
mavenJava(MavenPublication) {
91-
from components.java
92-
93-
artifact sourcesJar {
94-
classifier "sources"
95-
}
9684

97-
artifact javadocJar {
98-
classifier "javadoc"
85+
publishing {
86+
repositories {
87+
maven {
88+
name = "GitHubPackages"
89+
url = uri("https://maven.pkg.github.com/kimble/nmxmlp")
90+
credentials {
91+
username = System.getenv("GITHUB_ACTOR")
92+
password = System.getenv("GITHUB_TOKEN")
9993
}
10094
}
10195
}
102-
}
103-
104-
105-
if (System.getenv("BINTRAY_USER") && System.getenv("BINTRAY_KEY")) {
106-
bintray {
107-
user = System.getenv("BINTRAY_USER")
108-
key = System.getenv("BINTRAY_KEY")
109-
110-
publications = [ 'mavenJava' ]
111-
112-
dryRun = false
113-
publish = true
114-
115-
pkg { //package will be created if does not exist
116-
repo = 'maven'
117-
name = 'nmxmlp'
118-
desc = 'Simple Java-library for extracting and updating small-ish xml documents'
119-
120-
websiteUrl = 'https://github.com/kimble/nmxmlp'
121-
issueTrackerUrl = 'https://github.com/kimble/nmxmlp/issues'
122-
vcsUrl = 'https://github.com/kimble/nmxmlp.git'
123-
githubRepo = 'kimble/nmxmlp'
124-
githubReleaseNotesFile = 'README.md'
125-
126-
licenses = ['Apache-2.0']
127-
labels = ['java', 'xml', 'library']
128-
129-
publicDownloadNumbers = true
96+
publications {
97+
gpr(MavenPublication) {
98+
from(components.java)
13099
}
131100
}
132101
}
133-
else {
134-
logger.debug("Set bintrayUser and bintrayKey in ~/.gradle/gradle.properties to enable bintray upload")
135-
}

gradle/wrapper/gradle-wrapper.jar

3.01 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.2.2-bin.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

Lines changed: 12 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

gradlew.bat

Lines changed: 3 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)