diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ea4e73b --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,30 @@ +on: + workflow_dispatch: + +jobs: + publish: + name: Compile and publish OpusLib fork to Maven Central using gradle task + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [windows-latest] + + steps: + - name: Checkout project sources + uses: actions/checkout@v2 + + - name: Setup java + uses: actions/setup-java@v3 + with: + distribution: corretto + java-version: 8 + + - name: Setup Gradle + uses: gradle/gradle-build-action@v2 + + - name: launch library publish task + env: + SIMLA_MOBILE_APPS_EMAIL: ${{ secrets.SIMLA_MOBILE_APPS_EMAIL }} + OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} + OSSRH_PASSWORD: ${{ secrets.OSSRH_PASSWORD }} + run: ./gradlew :opuslib:publishReleasePublicationToMainRepository --stacktrace diff --git a/.gpg/SimlaTechSigning.gpg b/.gpg/SimlaTechSigning.gpg new file mode 100644 index 0000000..cc36640 Binary files /dev/null and b/.gpg/SimlaTechSigning.gpg differ diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle new file mode 100644 index 0000000..ce55e92 --- /dev/null +++ b/gradle/gradle-mvn-push.gradle @@ -0,0 +1,64 @@ +apply plugin: 'maven-publish' +apply plugin: 'signing' + +def versionName = "1.2.4" + +publishing { + publications { + release(MavenPublication) { + groupId = 'com.simla.android.opuslib' + version = versionName + + afterEvaluate { + from configurations.archives + } + artifactId = project.name + + pom { + name = 'OpusLib' + description = 'Re-publishing of OpusLib with no additional functionality.' + url = 'https://github.com/simla-tech/opus_android' + licenses { + license { + name = 'The Apache License, Version 2.0' + url = 'http://www.apache.org/licenses/LICENSE-2.0.txt' + } + } + developers { + developer { + id = 'SimlaTech' + name = 'Simla Mobile Dev Team' + email = findProperty("simlaTechEmail") ?: System.getenv("SIMLA_TECH_EMAIL") + } + } + scm { + connection = 'scm:git:git://github.com/simla-tech/opus_android.git' + developerConnection = 'scm:git:ssh://github.com/simla-tech/opus_android.git' + url = 'https://github.com/simla-tech/opus_android' + } + } + } + } + repositories { + maven { + name = "main" + url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/" + credentials { + username = findProperty("ossrhUsername") ?: System.getenv("OSSRH_USERNAME") + password = findProperty("ossrhPassword") ?: System.getenv("OSSRH_PASSWORD") + } + } + maven { + name = 'local' + url = "${findProperty("localMavenPath")}" + } + } +} + +signing { + //def signingKeyId = findProperty("signingKeyId") ?: System.getenv("SIGNING_KEY_ID") + //def signingKey = findProperty("signingKey") ?: System.getenv("SIGNING_KEY") + //def signingPassword = findProperty("signingKeyPassword") ?: System.getenv("SIGNING_KEY_PASSWORD") + //useInMemoryPgpKeys(/*signingKeyId,*/ signingKey, signingPassword) + sign configurations.archives +} diff --git a/opuslib/build.gradle b/opuslib/build.gradle index a2384e7..8610143 100644 --- a/opuslib/build.gradle +++ b/opuslib/build.gradle @@ -1,7 +1,8 @@ -import org.apache.tools.ant.taskdefs.condition.Os +//import org.apache.tools.ant.taskdefs.condition.Os +import org.gradle.plugins.signing.Sign apply plugin: 'com.android.library' -apply plugin: 'com.github.dcendents.android-maven' -apply plugin: 'com.jfrog.bintray' +//apply plugin: 'com.github.dcendents.android-maven' +//apply plugin: 'com.jfrog.bintray' version = "1.0.2" android { @@ -50,7 +51,7 @@ dependencies { compile fileTree(include: ['*.jar'], dir: 'libs') } - +/* def siteUrl = 'https://github.com/louisyonge/opus_android' // Project url def gitUrl = 'https://github.com/louisyonge/opus_android.git' // Git url group = "top.oply.opuslib" // Maven Group ID for the artifact,usually it's package name. @@ -86,6 +87,8 @@ install { } } } +// */ + task sourcesJar(type: Jar) { from android.sourceSets.main.java.srcDirs classifier = 'sources' @@ -102,6 +105,8 @@ artifacts { archives javadocJar archives sourcesJar } + +/* Properties properties = new Properties() properties.load(project.rootProject.file('local.properties').newDataInputStream()) bintray { @@ -117,3 +122,21 @@ bintray { publish = true } } +// */ + +apply from: rootProject.file('gradle/gradle-mvn-push.gradle') + +gradle.taskGraph.whenReady { taskGraph -> + if (taskGraph.allTasks.any { it instanceof Sign }) { + + def id = "42AAF42A" + def file = project.file('.gpg/SimlaTechSigning.gpg').absolutePath + def password = "retailcrm" + + allprojects { ext."signing.keyId" = id } + allprojects { ext."signing.secretKeyRingFile" = file } + allprojects { ext."signing.password" = password } + + console.printf "\nThanks.\n\n" + } +} \ No newline at end of file