Skip to content

Commit

Permalink
chore: Prepare for release.
Browse files Browse the repository at this point in the history
  • Loading branch information
nstdio committed Sep 7, 2021
1 parent 355da72 commit 9ddfdf3
Show file tree
Hide file tree
Showing 2 changed files with 116 additions and 2 deletions.
34 changes: 34 additions & 0 deletions .github/workflows/release.yml
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
84 changes: 82 additions & 2 deletions build.gradle
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
Expand All @@ -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 {
Expand All @@ -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()

Expand Down

0 comments on commit 9ddfdf3

Please sign in to comment.