diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yml similarity index 90% rename from .github/workflows/build.yaml rename to .github/workflows/build.yml index f3bb57f3f..7334f99ef 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yml @@ -15,7 +15,7 @@ jobs: name: "Build JDK 1.8" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2 - name: Set up JDK 1.8 uses: actions/setup-java@v2 with: @@ -27,7 +27,7 @@ jobs: name: "Build JDK 11" runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2.3.4 + - uses: actions/checkout@v2 - name: Set up JDK 11 uses: actions/setup-java@v2 with: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 000000000..f1e628065 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,34 @@ +name: Publish + +on: + release: + types: [published] + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up JDK 1.8 + uses: actions/setup-java@v2 + with: + distribution: 'zulu' + java-version: 8.0.x + - name: Set up GPG + run: echo -n "${GPG_PRIVATE_KEY}" | base64 --decode > ${GITHUB_WORKSPACE}/${GPG_KEY_ID}.gpg + env: + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} + - name: "Gradle Build" + run: ./gradlew build -Pversion=${GITHUB_REF:10} + - name: "Gradle Publish" + run: | + ./gradlew publishToSonatype -Pversion=${GITHUB_REF:10} \ + -Psigning.keyId=${GPG_KEY_ID} \ + -Psigning.password=${GPG_PASSPHRASE} \ + -Psigning.secretKeyRingFile=${GITHUB_WORKSPACE}/${GPG_KEY_ID}.gpg + env: + ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.OSSRH_USERNAME }} + ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.OSSRH_PASSWORD }} + GPG_KEY_ID: ${{ secrets.GPG_KEY_ID }} + GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index 0a72b1b46..000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,23 +0,0 @@ -name: Release - -on: - release: - types: [published] - -jobs: - build: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2.3.4 - - name: Set up JDK - uses: actions/setup-java@v2 - with: - distribution: 'zulu' - java-version: 8.0.x - - name: "Gradle Build" - run: ./gradlew build -Pversion=${GITHUB_REF:10} - - name: "Gradle Publish to Bintray" - env: - BINTRAY_USER: ${{ secrets.BINTRAY_USER }} - BINTRAY_API_KEY: ${{ secrets.BINTRAY_API_KEY }} - run: ./gradlew bintrayUpload -Pversion=${GITHUB_REF:10} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..ed630f050 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,18 @@ +name: Release + +on: + workflow_dispatch: + inputs: + releaseVersion: + description: "The release version in .. format" + required: true + nextVersion: + description: "The next version in . format WITHOUT SNAPSHOT SUFFIX" + required: true + +jobs: + triage: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2.3.4 + diff --git a/allure-junit-platform/build.gradle.kts b/allure-junit-platform/build.gradle.kts index a4b970826..417709e6b 100644 --- a/allure-junit-platform/build.gradle.kts +++ b/allure-junit-platform/build.gradle.kts @@ -40,14 +40,15 @@ tasks.test { } } -val spiOffJar by tasks.creating(Jar::class) { +val spiOffJar: Jar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").output) - classifier = "spi-off" + archiveClassifier.set("spi-off") } -val spiOff by configurations.creating { - extendsFrom(configurations.getByName("compile")) +publishing { + publications { + named("maven") { + artifact(spiOffJar) + } + } } - -artifacts.add("archives", spiOffJar) -artifacts.add("spiOff", spiOffJar) diff --git a/allure-junit5/build.gradle.kts b/allure-junit5/build.gradle.kts index 91499fd26..0b63accf3 100644 --- a/allure-junit5/build.gradle.kts +++ b/allure-junit5/build.gradle.kts @@ -38,15 +38,16 @@ tasks.test { } } -val spiOffJar by tasks.creating(Jar::class) { +val spiOffJar: Jar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").output) archiveClassifier.set("spi-off") } -val spiOff by configurations.creating { - extendsFrom(configurations.getByName("compile")) +publishing { + publications { + named("maven") { + artifact(spiOffJar) + } + } } -artifacts.add("archives", spiOffJar) -artifacts.add("spiOff", spiOffJar) - diff --git a/allure-model/build.gradle.kts b/allure-model/build.gradle.kts index 507dfdf45..9b5fb34fd 100644 --- a/allure-model/build.gradle.kts +++ b/allure-model/build.gradle.kts @@ -4,7 +4,7 @@ val agent: Configuration by configurations.creating dependencies { agent("org.aspectj:aspectjweaver") - implementation("com.fasterxml.jackson.core:jackson-databind") + implementation("com.fasterxml.jackson.core:jackson-databind:2.12.2") testImplementation("io.github.benas:random-beans") testImplementation("org.assertj:assertj-core") testImplementation("org.junit.jupiter:junit-jupiter-api") diff --git a/allure-testng/build.gradle.kts b/allure-testng/build.gradle.kts index c48c6d44c..f6b2d0107 100644 --- a/allure-testng/build.gradle.kts +++ b/allure-testng/build.gradle.kts @@ -39,14 +39,15 @@ tasks.test { } } -val spiOffJar by tasks.creating(Jar::class) { +val spiOffJar: Jar by tasks.creating(Jar::class) { from(sourceSets.getByName("main").output) - classifier = "spi-off" + archiveClassifier.set("spi-off") } -val spiOff by configurations.creating { - extendsFrom(configurations.getByName("compile")) +publishing { + publications { + named("maven") { + artifact(spiOffJar) + } + } } - -artifacts.add("archives", spiOffJar) -artifacts.add("spiOff", spiOffJar) diff --git a/build.gradle.kts b/build.gradle.kts index ed03769e5..b495319c7 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,8 +1,5 @@ import com.diffplug.gradle.spotless.SpotlessExtension -import io.qameta.allure.gradle.AllureExtension import io.qameta.allure.gradle.task.AllureReport -import io.spring.gradle.dependencymanagement.dsl.DependencyManagementExtension -import org.gradle.jvm.tasks.Jar import ru.vyarus.gradle.plugin.quality.QualityExtension buildscript { @@ -14,8 +11,6 @@ buildscript { dependencies { classpath("com.diffplug.spotless:spotless-plugin-gradle:5.12.4") - classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5") - classpath("io.spring.gradle:dependency-management-plugin:1.0.11.RELEASE") classpath("ru.vyarus:gradle-quality-plugin:4.5.0") } } @@ -37,7 +32,10 @@ tasks.withType(Wrapper::class) { plugins { java `java-library` - id("net.researchgate.release") version "2.8.1" + `maven-publish` + signing + id("io.spring.dependency-management") version "1.0.11.RELEASE" + id("io.github.gradle-nexus.publish-plugin") version "1.1.0" id("io.qameta.allure") version "2.8.1" } @@ -50,33 +48,32 @@ tasks.withType(JavaCompile::class) { options.encoding = "UTF-8" } -release { - tagTemplate = "\${version}" -} - -val afterReleaseBuild by tasks.existing - configure(listOf(rootProject)) { description = "Allure Java" group = "io.qameta.allure" } +nexusPublishing { + repositories { + sonatype() + } +} + configure(subprojects) { val project = this group = "io.qameta.allure" version = version apply(plugin = "java") + apply(plugin = "signing") apply(plugin = "java-library") - apply(plugin = "maven") - apply(plugin = "io.spring.dependency-management") + apply(plugin = "maven-publish") + apply(plugin = "io.qameta.allure") apply(plugin = "ru.vyarus.quality") apply(plugin = "com.diffplug.spotless") - apply(plugin = "io.qameta.allure") - apply(from = "$gradleScriptDir/bintray.gradle") - apply(from = "$gradleScriptDir/maven-publish.gradle") + apply(plugin = "io.spring.dependency-management") - configure { + dependencyManagement { imports { mavenBom("com.fasterxml.jackson:jackson-bom:2.12.3") mavenBom("org.junit:junit-bom:5.7.1") @@ -206,31 +203,63 @@ configure(subprojects) { encoding("UTF-8") } - configure { + allure { autoconfigure = false aspectjweaver = false } - val sourceJar by tasks.creating(Jar::class) { - from(sourceSets.getByName("main").allSource) - archiveClassifier.set("sources") - } - - val javadocJar by tasks.creating(Jar::class) { - from(tasks.getByName("javadoc")) - archiveClassifier.set("javadoc") + java { + withJavadocJar() + withSourcesJar() } tasks.withType(Javadoc::class) { (options as StandardJavadocDocletOptions).addStringOption("Xdoclint:none", "-quiet") } - artifacts.add("archives", sourceJar) - artifacts.add("archives", javadocJar) + publishing { + publications { + create("maven") { + from(components["java"]) + suppressAllPomMetadataWarnings() + pom { + name.set(project.name) + description.set("Module ${project.name} of Allure Framework.") + url.set("https://github.com/allure-framework/allure-java") + licenses { + license { + name.set("The Apache License, Version 2.0") + url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + } + } + developers { + developer { + id.set("baev") + name.set("Dmitry Baev") + email.set("dmitry.baev@qameta.io") + } + developer { + id.set("eroshenkoam") + name.set("Artem Eroshenko") + email.set("artem.eroshenko@qameta.io") + } + } + scm { + developerConnection.set("scm:git:git://github.com/allure-framework/allure-java") + connection.set("scm:git:git://github.com/allure-framework/allure-java") + url.set("https://github.com/allure-framework/allure-java") + } + issueManagement { + system.set("GitHub Issues") + url.set("https://github.com/allure-framework/allure-java/issues") + } + } + } + } + } - val bintrayUpload by tasks.existing - afterReleaseBuild { - dependsOn(bintrayUpload) + signing { + sign(publishing.publications["maven"]) } repositories { diff --git a/gradle/bintray.gradle b/gradle/bintray.gradle deleted file mode 100644 index 60e005f04..000000000 --- a/gradle/bintray.gradle +++ /dev/null @@ -1,31 +0,0 @@ -apply plugin: 'com.jfrog.bintray' - -bintray { - user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') - key = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') - - configurations = ['archives'] - - publish = true - pkg { - userOrg = 'qameta' - repo = 'maven' - name = 'allure-java' - desc = 'Allure Java integrations' - websiteUrl = 'https://github.com/allure-framework/allure-java' - issueTrackerUrl = 'https://github.com/allure-framework/allure-java' - vcsUrl = 'https://github.com/allure-framework/allure-java.git' - licenses = ['Apache-2.0'] - - githubRepo = 'allure-framework/allure-java' - githubReleaseNotesFile = 'README.md' - - version { - name = project.version - released = new Date() - gpg { - sign = true - } - } - } -} diff --git a/gradle/maven-publish.gradle b/gradle/maven-publish.gradle deleted file mode 100644 index 7543a22be..000000000 --- a/gradle/maven-publish.gradle +++ /dev/null @@ -1,55 +0,0 @@ -apply plugin: 'maven' - -install { - repositories.mavenInstaller { - customizePom(pom, project) - } -} - -def customizePom(pom, gradleProject) { - pom.whenConfigured { generatedPom -> - // eliminate testng-scoped dependencies (no need in maven central poms) - generatedPom.dependencies.removeAll { dep -> - dep.scope == "test" - } - - // sort to make pom dependencies order consistent to ease comparison of older poms - generatedPom.dependencies = generatedPom.dependencies.sort { dep -> - "$dep.scope:$dep.groupId:$dep.artifactId" - } - - // add all items necessary for maven central publication - generatedPom.project { - name = gradleProject.description - description = gradleProject.description - url = "https://github.com/allure-framework/allure-java" - organization { - name = "Qameta IO" - url = "https://qameta.io" - } - licenses { - license { - name = 'The Apache Software License, Version 2.0' - url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - scm { - url = 'https://github.com/allure-framework/allure-java' - connection = 'scm:git:git://github.com/allure-framework/allure-java' - developerConnection = 'scm:git:git://github.com/allure-framework/allure-java' - } - developers { - developer { - id = 'baev' - name = 'Dmitry Baev' - email = 'baev@qameta.io' - } - } - issueManagement { - system = 'Github Issues' - url = 'https://github.com/allure-framework/allure-java/issues' - } - } - } -}