Skip to content

Commit

Permalink
Added publish.yml workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
Lev Zakaryan committed Nov 6, 2024
1 parent 9d0eff2 commit 7778c5a
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 11 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
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 Android SDK
uses: android-actions/setup-android@v3
with:
cmdline-tools-version: 8512546
packages: 'build-tools;22.0.1 platforms;android-22'

- 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
Binary file added .gpg/SimlaTechSigning.gpg
Binary file not shown.
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ buildscript {
}
dependencies {
classpath 'com.android.tools.build:gradle:1.5.0'
classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
//classpath 'com.github.dcendents:android-maven-gradle-plugin:1.3'
//classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.2'
}
}

Expand Down
70 changes: 70 additions & 0 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
apply plugin: 'maven-publish'
apply plugin: 'signing'

def versionName = "1.0.2"

publishing {
publications {
release(MavenPublication) {
groupId = 'com.simla.android.opuslib'
version = versionName
artifactId = project.name

from components.java

// Add the javadocJar and sourcesJar as artifacts
artifact javadocJar
artifact sourcesJar

pom.withXml {
def root = asNode()

// Project name
root.appendNode('name', 'OpusLib')

// Project description
root.appendNode('description', 'Re-publishing of OpusLib with no additional functionality.')

// Project url
root.appendNode('url', 'https://github.com/simla-tech/opus_android')

// License information
def licenses = root.appendNode('licenses')
def license = licenses.appendNode('license')
license.appendNode('name', 'The Apache License, Version 2.0')
license.appendNode('url', 'http://www.apache.org/licenses/LICENSE-2.0.txt')

// Developer information
def developers = root.appendNode('developers')
def developer = developers.appendNode('developer')
developer.appendNode('id', 'SimlaTech')
developer.appendNode('name', 'Simla Mobile Dev Team')
developer.appendNode('email', System.getenv("SIMLA_TECH_EMAIL"))

// SCM (Source Control Management) information
def scm = root.appendNode('scm')
scm.appendNode('url', 'https://github.com/simla-tech/opus_android')
scm.appendNode('connection', 'scm:git:git://github.com/simla-tech/opus_android.git')
scm.appendNode('developerConnection', 'scm:git:ssh://github.com/simla-tech/opus_android.git')
}
}
}
repositories {
maven {
name = "main"
url "https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/"
credentials {
username = System.getenv("OSSRH_USERNAME")
password = System.getenv("OSSRH_PASSWORD")
}
}
}
}

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 publishing.publications.release
}
39 changes: 31 additions & 8 deletions opuslib/build.gradle
Original file line number Diff line number Diff line change
@@ -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 {
Expand All @@ -21,11 +22,11 @@ android {
}

task ndkBuild(type: Exec) {
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
//if (Os.isFamily(Os.FAMILY_WINDOWS)) {
commandLine 'ndk-build.cmd', '-C', file('src/main/jni').absolutePath
} else {
commandLine 'ndk-build', '-C', file('src/main/jni').absolutePath
}
//} else {
// commandLine 'ndk-build', '-C', file('src/main/jni').absolutePath
//}
}

tasks.withType(JavaCompile) {
Expand All @@ -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.
Expand Down Expand Up @@ -86,6 +87,8 @@ install {
}
}
}
// */

task sourcesJar(type: Jar) {
from android.sourceSets.main.java.srcDirs
classifier = 'sources'
Expand All @@ -102,6 +105,8 @@ artifacts {
archives javadocJar
archives sourcesJar
}

/*
Properties properties = new Properties()
properties.load(project.rootProject.file('local.properties').newDataInputStream())
bintray {
Expand All @@ -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"
}
}
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
include ':opuslib', ':oplayer',':sample1'
include ':opuslib'

0 comments on commit 7778c5a

Please sign in to comment.