Skip to content

Commit f9b01ad

Browse files
committed
Updating github actions and fingers crossed moving to Maven central
1 parent dd7d81f commit f9b01ad

File tree

11 files changed

+272
-146
lines changed

11 files changed

+272
-146
lines changed

.github/ISSUE_TEMPLATE/bug_report.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
**Describe the bug**
11+
A clear and concise description of what the bug is.
12+
13+
**To Reproduce**
14+
Please provide a code example or even better a test to reproduce the bug.

.github/ISSUE_TEMPLATE/other-issue.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
---
2+
name: Other issue
3+
about: Generic issue
4+
title: ''
5+
labels: ''
6+
assignees: ''
7+
8+
---
9+
10+
If you have a general question or seeking advice how to use something please create a new topic in our GitHub discussions forum: https://github.com/graphql-java/graphql-java/discussions. Thanks.

.github/workflows/master.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: Master Build and Publish
2+
# For master push: Builds and publishes the development version to bintray/maven
3+
on:
4+
push:
5+
branches:
6+
- master
7+
jobs:
8+
buildAndPublish:
9+
runs-on: ubuntu-latest
10+
env:
11+
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
12+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
13+
MAVEN_CENTRAL_PGP_KEY: ${{ secrets.MAVEN_CENTRAL_PGP_KEY }}
14+
15+
steps:
16+
- uses: actions/checkout@v1
17+
- uses: gradle/wrapper-validation-action@v1
18+
- name: Set up JDK 1.8
19+
uses: actions/setup-java@v1
20+
with:
21+
java-version: '8.0.282'
22+
- name: build test and publish
23+
run: ./gradlew assemble && ./gradlew check --info && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -x check --info --stacktrace

.github/workflows/pull_request.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Pull Request Build
2+
# For pull requests: builds and test
3+
on:
4+
push:
5+
branches:
6+
- '!master'
7+
pull_request:
8+
branches:
9+
- master
10+
jobs:
11+
buildAndTest:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v1
15+
- uses: gradle/wrapper-validation-action@v1
16+
- name: Set up JDK 1.8
17+
uses: actions/setup-java@v1
18+
with:
19+
java-version: '8.0.282'
20+
- name: build and test
21+
run: ./gradlew assemble && ./gradlew check --info --stacktrace

.github/workflows/release.yml

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
name: Manual Release Build
2+
# Release builds
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'the version to be released'
8+
required: true
9+
10+
jobs:
11+
buildAndPublish:
12+
runs-on: ubuntu-latest
13+
env:
14+
MAVEN_CENTRAL_PGP_KEY: ${{ secrets.MAVEN_CENTRAL_PGP_KEY }}
15+
MAVEN_CENTRAL_USER: ${{ secrets.MAVEN_CENTRAL_USER }}
16+
MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
17+
RELEASE_VERSION: ${{ github.event.inputs.version }}
18+
19+
steps:
20+
- uses: actions/checkout@v1
21+
- uses: gradle/wrapper-validation-action@v1
22+
- name: Set up JDK 1.8
23+
uses: actions/setup-java@v1
24+
with:
25+
java-version: '8.0.282'
26+
- name: build test and publish
27+
run: ./gradlew assemble && ./gradlew check --info && ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository -x check --info --stacktrace

build.gradle

Lines changed: 140 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -1,68 +1,165 @@
11
import java.text.SimpleDateFormat
22

3-
buildscript {
4-
repositories {
5-
jcenter()
6-
}
7-
dependencies {
8-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7'
9-
}
3+
plugins {
4+
id 'java'
5+
id 'java-library'
6+
id 'maven'
7+
id 'maven-publish'
8+
id 'signing'
9+
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
1010
}
1111

12-
apply plugin: 'maven-publish'
1312

14-
publishing {
15-
repositories {
16-
maven {
17-
url 'https://dl.bintray.com/bbakerman/maven'
18-
}
13+
def getDevelopmentVersion() {
14+
def output = new StringBuilder()
15+
def error = new StringBuilder()
16+
def gitShortHash = ["git", "-C", projectDir.toString(), "rev-parse", "--short", "HEAD"].execute()
17+
gitShortHash.waitForProcessOutput(output, error)
18+
def gitHash = output.toString().trim()
19+
if (gitHash.isEmpty()) {
20+
println "git hash is empty: error: ${error.toString()}"
21+
throw new IllegalStateException("git hash could not be determined")
1922
}
23+
def version = new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-" + gitHash
24+
println "created development version: $version"
25+
version
2026
}
2127

22-
ext {
23-
junitVersion = '4.12'
24-
slf4jVersion = '1.7.25'
28+
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
29+
def msg = String.format("This build must be run with java 1.8 - you are running %s - gradle finds the JDK via JAVA_HOME=%s",
30+
JavaVersion.current(), System.getenv("JAVA_HOME"))
31+
throw new IllegalStateException(msg)
2532
}
2633

27-
apply plugin: 'java'
28-
apply plugin: 'maven'
29-
apply plugin: 'osgi'
30-
apply from: "$projectDir/gradle/publishing.gradle"
34+
35+
sourceCompatibility = 1.8
36+
targetCompatibility = 1.8
37+
def slf4jVersion = '1.7.30'
38+
def releaseVersion = System.env.RELEASE_VERSION
39+
version = releaseVersion ? releaseVersion : getDevelopmentVersion()
40+
group = 'com.graphql-java'
41+
description = 'A pure Java 8 port of Facebook Dataloader'
3142

3243
repositories {
33-
mavenLocal()
3444
mavenCentral()
35-
jcenter()
36-
maven {
37-
url 'https://dl.bintray.com/engagingspaces/maven'
38-
}
45+
mavenLocal()
3946
}
4047

41-
def releaseVersion = System.properties.RELEASE_VERSION
42-
version = releaseVersion ? releaseVersion : new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date())
43-
group = 'org.dataloader'
44-
description = 'A pure Java 8 port of Facebook Dataloader'
45-
46-
compileJava {
47-
sourceCompatibility = 1.8
48-
targetCompatibility = 1.8
48+
apply plugin: 'groovy'
4949

50-
options.compilerArgs = ["-Xlint:unchecked", "-Xdiags:verbose", "-Xdoclint:none"]
51-
}
52-
53-
task myJavadocs(type: Javadoc) {
54-
source = sourceSets.main.allJava
55-
options.addStringOption('Xdoclint:none', '-quiet')
50+
jar {
51+
manifest {
52+
attributes('Automatic-Module-Name': 'com.graphql-java')
53+
}
5654
}
5755

5856
dependencies {
5957
compile 'org.slf4j:slf4j-api:' + slf4jVersion
6058
testCompile 'org.slf4j:slf4j-simple:' + slf4jVersion
61-
testCompile "junit:junit:$junitVersion"
59+
testCompile "junit:junit:4.12"
6260
testCompile 'org.awaitility:awaitility:2.0.0'
6361
}
6462

65-
task wrapper(type: Wrapper) {
66-
gradleVersion = '4.0'
67-
distributionUrl = "https://services.gradle.org/distributions/gradle-4.0-all.zip"
63+
task sourcesJar(type: Jar) {
64+
dependsOn classes
65+
classifier 'sources'
66+
from sourceSets.main.allSource
67+
}
68+
69+
task javadocJar(type: Jar, dependsOn: javadoc) {
70+
classifier = 'javadoc'
71+
from javadoc.destinationDir
72+
}
73+
74+
javadoc {
75+
options.encoding = 'UTF-8'
76+
}
77+
78+
artifacts {
79+
archives sourcesJar
80+
archives javadocJar
81+
}
82+
83+
test {
84+
testLogging {
85+
exceptionFormat = 'full'
86+
}
6887
}
88+
89+
publishing {
90+
publications {
91+
graphqlJava(MavenPublication) {
92+
from components.java
93+
groupId 'com.graphql-java'
94+
artifactId 'java-dataloader'
95+
version project.version
96+
97+
artifact sourcesJar
98+
artifact javadocJar
99+
100+
pom.withXml {
101+
asNode().children().last() + {
102+
resolveStrategy = Closure.DELEGATE_FIRST
103+
name 'java-dataloader'
104+
description 'A pure Java 8 port of Facebook Dataloader'
105+
url 'https://github.com/graphql-java/java-dataloader'
106+
inceptionYear '2017'
107+
108+
scm {
109+
url 'https://github.com/graphql-java/java-dataloader'
110+
connection 'scm:[email protected]:graphql-java/java-dataloader.git'
111+
developerConnection 'scm:[email protected]:graphql-java/java-dataloader.git'
112+
}
113+
114+
licenses {
115+
license {
116+
name 'The Apache Software License, Version 2.0'
117+
url 'https://www.apache.org/licenses/LICENSE-2.0.txt'
118+
distribution 'repo'
119+
}
120+
}
121+
122+
developers {
123+
developer {
124+
id 'bbakerman'
125+
name 'Brad Baker'
126+
127+
}
128+
developer {
129+
id 'aschrijver'
130+
name 'Arnold Schrijver'
131+
}
132+
}
133+
}
134+
}
135+
}
136+
}
137+
}
138+
139+
nexusPublishing {
140+
repositories {
141+
sonatype {
142+
username = System.env.MAVEN_CENTRAL_USER
143+
password = System.env.MAVEN_CENTRAL_PASSWORD
144+
}
145+
}
146+
}
147+
148+
signing {
149+
def signingKey = System.env.MAVEN_CENTRAL_PGP_KEY
150+
useInMemoryPgpKeys(signingKey, "")
151+
sign publishing.publications
152+
}
153+
154+
155+
// all publish tasks depend on the build task
156+
tasks.withType(PublishToMavenRepository) {
157+
dependsOn build
158+
}
159+
160+
161+
task myWrapper(type: Wrapper) {
162+
gradleVersion = '6.6.1'
163+
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
164+
}
165+

0 commit comments

Comments
 (0)