Skip to content
This repository was archived by the owner on Oct 25, 2021. It is now read-only.

Commit 9d81317

Browse files
committed
build work
1 parent c6606f6 commit 9d81317

File tree

9 files changed

+169
-80
lines changed

9 files changed

+169
-80
lines changed
File renamed without changes.

build.gradle

Lines changed: 40 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,57 @@
11
import java.text.SimpleDateFormat
22

3+
plugins {
4+
id "io.github.gradle-nexus.publish-plugin" version "1.0.0"
5+
}
6+
7+
38
def getDevelopmentVersion() {
49
def output = new StringBuilder()
510
def error = new StringBuilder()
6-
def gitShortHash = "git -C ${projectDir} rev-parse --short HEAD".execute()
11+
def gitShortHash = ["git", "-C", projectDir.toString(), "rev-parse", "--short", "HEAD"].execute()
712
gitShortHash.waitForProcessOutput(output, error)
813
def gitHash = output.toString().trim()
914
if (gitHash.isEmpty()) {
1015
println "git hash is empty: error: ${error.toString()}"
1116
throw new IllegalStateException("git hash could not be determined")
1217
}
13-
new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-" + gitHash
18+
def version = new SimpleDateFormat('yyyy-MM-dd\'T\'HH-mm-ss').format(new Date()) + "-" + gitHash
19+
println "created development version: $version"
20+
version
21+
}
22+
23+
if (JavaVersion.current() != JavaVersion.VERSION_1_8) {
24+
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",
25+
JavaVersion.current(), System.getenv("JAVA_HOME"))
26+
throw new GradleException(msg)
27+
}
28+
29+
30+
repositories {
31+
mavenCentral()
32+
mavenLocal()
1433
}
1534

16-
buildscript {
35+
nexusPublishing {
1736
repositories {
18-
jcenter()
19-
}
20-
dependencies {
21-
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
37+
sonatype {
38+
username = System.env.MAVEN_CENTRAL_USER
39+
password = System.env.MAVEN_CENTRAL_PASSWORD
40+
}
2241
}
2342
}
2443

44+
45+
2546
subprojects {
2647

27-
apply plugin: 'com.jfrog.bintray'
2848
apply plugin: 'java'
49+
apply plugin: 'java-library'
2950
apply plugin: 'maven'
3051
apply plugin: 'maven-publish'
3152
apply plugin: 'groovy'
32-
53+
apply plugin: 'signing'
54+
// apply plugin: "io.github.gradle-nexus.publish-plugin"
3355

3456

3557
sourceCompatibility = 1.8
@@ -117,45 +139,23 @@ subprojects {
117139
}
118140

119141

120-
bintray {
121-
user = System.env.BINTRAY_USER ?: project["bintray.user"]
122-
key = System.env.BINTRAY_API_KEY ?: project["bintray.key"]
123-
publications = ['graphqlJava']
124-
publish = true
125-
pkg {
126-
repo = 'graphql-java'
127-
name = project.name
128-
desc = project.description
129-
licenses = ['MIT']
130-
vcsUrl = 'https://github.com/graphql-java/graphql-java-spring'
131-
132-
version {
133-
name = project.version
134-
desc = project.description
135-
released = new Date()
136-
vcsTag = 'v' + project.version
137-
gpg {
138-
sign = true
139-
}
140-
mavenCentralSync {
141-
sync = true
142-
user = System.env.MAVEN_CENTRAL_USER
143-
password = System.env.MAVEN_CENTRAL_PASSWORD
144-
close = '1'
145-
}
146-
}
147-
}
148-
}
149-
150142
// all publish tasks depend on the build task
151143
tasks.withType(PublishToMavenRepository) {
152144
dependsOn build
153145
}
154146

147+
signing {
148+
def signingKey = System.env.MAVEN_CENTRAL_PGP_KEY
149+
useInMemoryPgpKeys(signingKey, "")
150+
sign publishing.publications
151+
}
152+
153+
155154
}
156155

156+
157157
task myWrapper(type: Wrapper) {
158-
gradleVersion = '4.10.2'
158+
gradleVersion = '6.6.1'
159159
distributionUrl = "https://services.gradle.org/distributions/gradle-${gradleVersion}-all.zip"
160160
}
161161

gradle/wrapper/gradle-wrapper.jar

2.96 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-4.10.2-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-all.zip
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists

gradlew

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

gradlew.bat

Lines changed: 24 additions & 19 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on 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

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

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

0 commit comments

Comments
 (0)