-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
116 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Release | ||
on: | ||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'The release version' | ||
required: true | ||
|
||
jobs: | ||
build: | ||
name: Release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Set up JDK 11 | ||
uses: actions/setup-java@v1 | ||
with: | ||
java-version: 11 | ||
- name: Cache Gradle packages | ||
uses: actions/cache@v1 | ||
with: | ||
path: ~/.gradle/caches | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} | ||
restore-keys: ${{ runner.os }}-gradle | ||
- name: Build | ||
run: ./gradlew build --stacktrace | ||
- name: Release | ||
env: | ||
RELEASE_VERSION: ${{ github.event.inputs.version }} | ||
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.SONATYPE_USERNAME }} | ||
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.SONATYPE_PASSWORD }} | ||
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.SIGNING_KEY }} | ||
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.SIGNING_PASSWORD }} | ||
run: ./gradlew release -Prelease.useAutomaticVersion=true -Prelease.releaseVersion=$RELEASE_VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,14 @@ | ||
plugins { | ||
id 'java-library' | ||
id 'jacoco' | ||
id 'signing' | ||
id 'maven-publish' | ||
id 'org.sonarqube' version '3.3' | ||
id "io.github.gradle-nexus.publish-plugin" version "1.1.0" | ||
id "net.researchgate.release" version "2.8.1" | ||
} | ||
|
||
group 'io.github.nstdio' | ||
version '1.0-SNAPSHOT' | ||
|
||
sourceCompatibility = JavaVersion.VERSION_11 | ||
targetCompatibility = JavaVersion.VERSION_11 | ||
|
@@ -20,7 +23,6 @@ ext { | |
commonIoVersion = '1.3.2' | ||
assertJVersion = '3.20.2' | ||
jsonPathAssertVersion = '2.6.0' | ||
lombokDependency = 'org.projectlombok:lombok:1.18.20' | ||
} | ||
|
||
dependencies { | ||
|
@@ -44,6 +46,84 @@ sonarqube { | |
} | ||
} | ||
|
||
task javadocJar(type: Jar) { | ||
archiveClassifier = 'javadoc' | ||
from javadoc | ||
} | ||
|
||
task sourcesJar(type: Jar) { | ||
archiveClassifier = 'sources' | ||
from sourceSets.main.allSource | ||
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from(components.java) | ||
artifact sourcesJar | ||
artifact javadocJar | ||
pom { | ||
name = 'JDK Http Client Extensions' | ||
description = 'The set of usefult extensions for JDK HttpClient.' | ||
url = 'https://github.com/nstdio/http-client-ext' | ||
|
||
scm { | ||
connection = 'scm:git:[email protected]:nstdio/http-client-ext.git' | ||
developerConnection = 'scm:git:[email protected]:nstdio/http-client-ext.git' | ||
url = 'https://github.com/nstdio/http-client-ext' | ||
} | ||
|
||
licenses { | ||
license { | ||
name = 'The Apache License, Version 2.0' | ||
url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' | ||
} | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'nstdio' | ||
name = 'Edgar Asatryan' | ||
email = '[email protected]' | ||
} | ||
} | ||
|
||
} | ||
} | ||
} | ||
} | ||
|
||
nexusPublishing { | ||
repositories { | ||
sonatype { | ||
def urlBase = "https://s01.oss.sonatype.org" | ||
nexusUrl = uri("$urlBase/service/local/") | ||
snapshotRepositoryUrl = uri("$urlBase/content/repositories/snapshots/") | ||
} | ||
} | ||
} | ||
|
||
signing { | ||
def signingKey = findProperty("signingKey") | ||
def signingPassword = findProperty("signingPassword") | ||
useInMemoryPgpKeys(signingKey, signingPassword) | ||
|
||
sign publishing.publications.mavenJava | ||
} | ||
|
||
release { | ||
tagTemplate = 'v${version}' | ||
|
||
git { | ||
requireBranch = 'main' | ||
pushToRemote = 'origin' | ||
} | ||
} | ||
|
||
afterEvaluate { | ||
afterReleaseBuild.dependsOn publishToSonatype, closeAndReleaseSonatypeStagingRepository | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
|
||
|