New publication configuration (#14)
* add Dokka + align POM metadatas with sonatype requirements * update snapshot CI * update JNI publication * update CI scripts * remove maven-metadata-local.xml * add snapshot publication with maven-publish plugin
This commit is contained in:
parent
7d22d835a5
commit
f493edfdfb
32
.github/workflows/release.yml
vendored
32
.github/workflows/release.yml
vendored
@ -89,24 +89,38 @@ jobs:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
shell: bash
|
||||
run: ./gradlew publishLinuxPublicationToBintrayRepository :jni:jvm:linux:publishJvmPublicationToBintrayRepository
|
||||
# ./gradlew publishLinuxPublicationToBintrayRepository :jni:jvm:linux:publishJvmPublicationToBintrayRepository
|
||||
run: ./gradlew publishLinuxPublicationToMavenLocal :jni:jvm:linux:publishJvmPublicationToMavenLocal
|
||||
- name: Publish Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
shell: bash
|
||||
run: ./gradlew :jni:jvm:mingw:publishJvmPublicationToBintrayRepository
|
||||
# ./gradlew :jni:jvm:mingw:publishJvmPublicationToBintrayRepository
|
||||
run: ./gradlew :jni:jvm:mingw:publishToMavenLocal
|
||||
- name: Publish MacOS
|
||||
if: matrix.os == 'macOS-latest'
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
shell: bash
|
||||
run: ./gradlew publish
|
||||
- name: Discard
|
||||
if: ${{ failure() || cancelled() }}
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
run: ./gradlew postBintrayDiscard
|
||||
# ./gradlew publish
|
||||
run: ./gradlew publishToMavenLocal
|
||||
- name: Copy artifact files
|
||||
run: |
|
||||
mkdir -p maven-local/release
|
||||
cp -r ~/.m2/repository/* maven-local/release
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: release
|
||||
path: |
|
||||
maven-local
|
||||
!maven-local/**/maven-metadata-local.xml
|
||||
# - name: Discard
|
||||
# if: ${{ failure() || cancelled() }}
|
||||
# env:
|
||||
# BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
# BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
# run: ./gradlew postBintrayDiscard
|
||||
|
83
.github/workflows/snapshot.yml
vendored
83
.github/workflows/snapshot.yml
vendored
@ -3,7 +3,7 @@ name: Publish snapshot
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'snapshot/*'
|
||||
- 'master'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '**.adoc'
|
||||
@ -97,49 +97,64 @@ jobs:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
shell: bash
|
||||
run: ./gradlew publishLinuxPublicationToBintrayRepository :jni:jvm:linux:publishJvmPublicationToBintrayRepository -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
# ./gradlew publishLinuxPublicationToBintrayRepository :jni:jvm:linux:publishJvmPublicationToBintrayRepository -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
run: ./gradlew publishLinuxPublicationToMavenLocal :jni:jvm:linux:publishJvmPublicationToMavenLocal -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
- name: Publish Windows
|
||||
if: matrix.os == 'windows-latest'
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
shell: bash
|
||||
run: ./gradlew :jni:jvm:mingw:publishJvmPublicationToBintrayRepository -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
# ./gradlew :jni:jvm:mingw:publishJvmPublicationToBintrayRepository -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
run: ./gradlew :jni:jvm:mingw:publishToMavenLocal -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
- name: Publish MacOS
|
||||
if: matrix.os == 'macOS-latest'
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
shell: bash
|
||||
run: ./gradlew publish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
- name: Discard
|
||||
if: ${{ failure() || cancelled() }}
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
run: ./gradlew postBintrayDiscard -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
# ./gradlew publish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
run: ./gradlew publishToMavenLocal -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
- name: Copy artifact files
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p maven-local/snapshot
|
||||
cp -r ~/.m2/repository/* maven-local/snapshot
|
||||
- name: Upload artifacts
|
||||
uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: snapshot
|
||||
path: |
|
||||
maven-local
|
||||
!maven-local/**/maven-metadata-local.xml
|
||||
# - name: Discard
|
||||
# if: ${{ failure() || cancelled() }}
|
||||
# env:
|
||||
# BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
# BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
# run: ./gradlew postBintrayDiscard -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
|
||||
publish:
|
||||
name: Publish
|
||||
needs: upload
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Check out
|
||||
uses: actions/checkout@v2
|
||||
with:
|
||||
submodules: 'true'
|
||||
- name: Cached Gradle
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.gradle
|
||||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
restore-keys: ${{ runner.os }}-gradle-
|
||||
- name: Set up JDK 11
|
||||
uses: actions/setup-java@v1
|
||||
with:
|
||||
java-version: 11
|
||||
- name: Publish
|
||||
env:
|
||||
BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
run: ./gradlew postBintrayPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
||||
# publish:
|
||||
# name: Publish
|
||||
# needs: upload
|
||||
# runs-on: ubuntu-latest
|
||||
# steps:
|
||||
# - name: Check out
|
||||
# uses: actions/checkout@v2
|
||||
# with:
|
||||
# submodules: 'true'
|
||||
# - name: Cached Gradle
|
||||
# uses: actions/cache@v2
|
||||
# with:
|
||||
# path: ~/.gradle
|
||||
# key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}
|
||||
# restore-keys: ${{ runner.os }}-gradle-
|
||||
# - name: Set up JDK 11
|
||||
# uses: actions/setup-java@v1
|
||||
# with:
|
||||
# java-version: 11
|
||||
# - name: Publish
|
||||
# env:
|
||||
# BINTRAY_USER: ${{ secrets.bintray_user }}
|
||||
# BINTRAY_APIKEY: ${{ secrets.bintray_apikey }}
|
||||
# run: ./gradlew postBintrayPublish -PsnapshotNumber=${{ github.run_number }} -PgitRef=${{ github.ref }}
|
2
.github/workflows/test.yml
vendored
2
.github/workflows/test.yml
vendored
@ -10,7 +10,7 @@ on:
|
||||
- '!.github/workflows/test.yml'
|
||||
push:
|
||||
branches:
|
||||
- 'master'
|
||||
- '!master'
|
||||
paths-ignore:
|
||||
- '**.md'
|
||||
- '**.adoc'
|
||||
|
@ -6,9 +6,11 @@ import org.apache.http.impl.auth.BasicScheme
|
||||
import org.apache.http.auth.UsernamePasswordCredentials
|
||||
import org.gradle.internal.os.OperatingSystem
|
||||
import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
|
||||
import org.jetbrains.dokka.Platform
|
||||
|
||||
plugins {
|
||||
kotlin("multiplatform") version "1.4.31"
|
||||
id("org.jetbrains.dokka") version "1.4.20"
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -16,20 +18,23 @@ buildscript {
|
||||
repositories {
|
||||
google()
|
||||
mavenCentral()
|
||||
jcenter()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
classpath("com.android.tools.build:gradle:4.0.2")
|
||||
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.4.20")
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
group = "fr.acinq.secp256k1"
|
||||
version = "0.5.0"
|
||||
version = "0.5.1-SNAPSHOT"
|
||||
|
||||
repositories {
|
||||
jcenter()
|
||||
google()
|
||||
mavenCentral()
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,22 +112,30 @@ allprojects {
|
||||
}
|
||||
}
|
||||
|
||||
val snapshotNumber: String? by project
|
||||
val gitRef: String? by project
|
||||
val eapBranch = gitRef?.split("/")?.last() ?: "dev"
|
||||
val bintrayVersion = if (snapshotNumber != null) "${project.version}-$eapBranch-$snapshotNumber" else project.version.toString()
|
||||
val bintrayRepo = if (snapshotNumber != null) "snapshots" else "libs"
|
||||
// Publication
|
||||
val bintrayRepo = if (project.version.toString().contains("SNAPSHOT")) "snapshots" else "libs"
|
||||
|
||||
val bintrayUsername: String? = (properties["bintrayUsername"] as String?) ?: System.getenv("BINTRAY_USER")
|
||||
val bintrayApiKey: String? = (properties["bintrayApiKey"] as String?) ?: System.getenv("BINTRAY_APIKEY")
|
||||
val hasBintray = bintrayUsername != null && bintrayApiKey != null
|
||||
if (!hasBintray) logger.warn("Skipping bintray configuration as bintrayUsername or bintrayApiKey is not defined")
|
||||
|
||||
val sonatypeUsername: String? = (properties["sonatypeUsername"] as String?) ?: System.getenv("SONATYPE_USERNAME")
|
||||
val sonatypePassword: String? = (properties["sonatypePassword"] as String?) ?: System.getenv("SONATYPE_PASSWORD")
|
||||
val hasSonatype = sonatypeUsername != null && sonatypePassword != null
|
||||
if (!hasSonatype) logger.warn("Skipping sonatype snapshot configuration as sonatypeUsername or sonatypePassword is not defined")
|
||||
|
||||
allprojects {
|
||||
val javadocJar = tasks.create<Jar>("javadocJar") {
|
||||
archiveClassifier.set("javadoc")
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
}
|
||||
|
||||
// Publication
|
||||
plugins.withId("maven-publish") {
|
||||
publishing {
|
||||
if (hasBintray) {
|
||||
repositories {
|
||||
repositories {
|
||||
if (hasBintray) {
|
||||
maven {
|
||||
name = "bintray"
|
||||
setUrl("https://api.bintray.com/maven/acinq/$bintrayRepo/${rootProject.name}/;publish=0")
|
||||
@ -132,16 +145,31 @@ allprojects {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasSonatype) {
|
||||
maven {
|
||||
name = "snapshot"
|
||||
setUrl("https://oss.sonatype.org/content/repositories/snapshots")
|
||||
credentials {
|
||||
username = sonatypeUsername
|
||||
password = sonatypePassword
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
publications.withType<MavenPublication>().configureEach {
|
||||
version = bintrayVersion
|
||||
version = project.version.toString()
|
||||
artifact(javadocJar)
|
||||
pom {
|
||||
name.set("secp256k1 for Kotlin/Multiplatform")
|
||||
description.set("Bitcoin's secp256k1 library ported to Kotlin/Multiplatform for JVM, Android, iOS & Linux")
|
||||
url.set("https://github.com/ACINQ/secp256k1-kmp")
|
||||
licenses {
|
||||
name.set("Apache License v2.0")
|
||||
url.set("https://www.apache.org/licenses/LICENSE-2.0")
|
||||
license {
|
||||
name.set("Apache License v2.0")
|
||||
url.set("https://www.apache.org/licenses/LICENSE-2.0")
|
||||
}
|
||||
}
|
||||
issueManagement {
|
||||
system.set("Github")
|
||||
@ -149,18 +177,58 @@ allprojects {
|
||||
}
|
||||
scm {
|
||||
connection.set("https://github.com/ACINQ/secp256k1-kmp.git")
|
||||
url.set("https://github.com/ACINQ/secp256k1-kmp")
|
||||
}
|
||||
developers {
|
||||
developer {
|
||||
name.set("ACINQ")
|
||||
email.set("hello@acinq.co")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (project.name !in listOf("native", "tests")) {
|
||||
afterEvaluate {
|
||||
val dokkaOutputDir = buildDir.resolve("dokka")
|
||||
|
||||
tasks.dokkaHtml {
|
||||
outputDirectory.set(file(dokkaOutputDir))
|
||||
dokkaSourceSets {
|
||||
configureEach {
|
||||
val platformName = when (platform.get()) {
|
||||
Platform.jvm -> "jvm"
|
||||
Platform.js -> "js"
|
||||
Platform.native -> "native"
|
||||
Platform.common -> "common"
|
||||
}
|
||||
displayName.set(platformName)
|
||||
|
||||
perPackageOption {
|
||||
matchingRegex.set(".*\\.internal.*") // will match all .internal packages and sub-packages
|
||||
suppress.set(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val deleteDokkaOutputDir by tasks.register<Delete>("deleteDokkaOutputDirectory") {
|
||||
delete(dokkaOutputDir)
|
||||
}
|
||||
|
||||
javadocJar.dependsOn(deleteDokkaOutputDir, tasks.dokkaHtml)
|
||||
javadocJar.from(dokkaOutputDir)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (hasBintray) {
|
||||
val postBintrayPublish by tasks.creating {
|
||||
doLast {
|
||||
HttpClients.createDefault().use { client ->
|
||||
val post = HttpPost("https://api.bintray.com/content/acinq/$bintrayRepo/${rootProject.name}/$bintrayVersion/publish").apply {
|
||||
val post = HttpPost("https://api.bintray.com/content/acinq/$bintrayRepo/${rootProject.name}/${project.version.toString()}/publish").apply {
|
||||
entity = StringEntity("{}", ContentType.APPLICATION_JSON)
|
||||
addHeader(BasicScheme().authenticate(UsernamePasswordCredentials(bintrayUsername, bintrayApiKey), this, null))
|
||||
}
|
||||
@ -172,7 +240,7 @@ if (hasBintray) {
|
||||
val postBintrayDiscard by tasks.creating {
|
||||
doLast {
|
||||
HttpClients.createDefault().use { client ->
|
||||
val post = HttpPost("https://api.bintray.com/content/acinq/$bintrayRepo/${rootProject.name}/$bintrayVersion/publish").apply {
|
||||
val post = HttpPost("https://api.bintray.com/content/acinq/$bintrayRepo/${rootProject.name}/${project.version.toString()}/publish").apply {
|
||||
entity = StringEntity("{ \"discard\": true }", ContentType.APPLICATION_JSON)
|
||||
addHeader(BasicScheme().authenticate(UsernamePasswordCredentials(bintrayUsername, bintrayApiKey), this, null))
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
import org.jetbrains.dokka.Platform
|
||||
|
||||
plugins {
|
||||
id("com.android.library")
|
||||
kotlin("android")
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -53,6 +56,11 @@ afterEvaluate {
|
||||
create<MavenPublication>("android") {
|
||||
artifactId = "secp256k1-kmp-jni-android"
|
||||
from(components["release"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
from(android.sourceSets["main"].java.srcDirs)
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,8 @@
|
||||
import org.jetbrains.dokka.Platform
|
||||
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -36,6 +39,11 @@ publishing {
|
||||
create<MavenPublication>("jvm") {
|
||||
artifactId = "secp256k1-kmp-jni-common"
|
||||
from(components["java"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
from(sourceSets["main"].allSource)
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
`java-library`
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -14,6 +15,10 @@ publishing {
|
||||
create<MavenPublication>("jvm") {
|
||||
artifactId = "secp256k1-kmp-jni-jvm"
|
||||
from(components["java"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -35,6 +36,10 @@ publishing {
|
||||
create<MavenPublication>("jvm") {
|
||||
artifactId = "secp256k1-kmp-jni-jvm-extract"
|
||||
from(components["java"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1,5 +1,7 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
`java-library`
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -25,6 +27,10 @@ publishing {
|
||||
val pub = create<MavenPublication>("jvm") {
|
||||
artifactId = "secp256k1-kmp-jni-jvm-darwin"
|
||||
from(components["java"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
if (!org.gradle.internal.os.OperatingSystem.current().isMacOsX) {
|
||||
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != pub } }
|
||||
|
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -25,6 +26,10 @@ publishing {
|
||||
val pub = create<MavenPublication>("jvm") {
|
||||
artifactId = "secp256k1-kmp-jni-jvm-linux"
|
||||
from(components["java"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
if (!org.gradle.internal.os.OperatingSystem.current().isLinux) {
|
||||
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != pub } }
|
||||
|
@ -1,5 +1,6 @@
|
||||
plugins {
|
||||
kotlin("jvm")
|
||||
id("org.jetbrains.dokka")
|
||||
`maven-publish`
|
||||
}
|
||||
|
||||
@ -25,6 +26,10 @@ publishing {
|
||||
val pub = create<MavenPublication>("jvm") {
|
||||
artifactId = "secp256k1-kmp-jni-jvm-mingw"
|
||||
from(components["java"])
|
||||
val sourcesJar = task<Jar>("sourcesJar") {
|
||||
archiveClassifier.set("sources")
|
||||
}
|
||||
artifact(sourcesJar)
|
||||
}
|
||||
if (!org.gradle.internal.os.OperatingSystem.current().isWindows) {
|
||||
tasks.withType<AbstractPublishToMaven>().all { onlyIf { publication != pub } }
|
||||
|
Loading…
x
Reference in New Issue
Block a user