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 b789b15
Show file tree
Hide file tree
Showing 4 changed files with 121 additions and 4 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -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
Binary file added .gpg/SimlaTechSigning.gpg
Binary file not shown.
64 changes: 64 additions & 0 deletions gradle/gradle-mvn-push.gradle
Original file line number Diff line number Diff line change
@@ -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
}
31 changes: 27 additions & 4 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 Down Expand Up @@ -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"
}
}

0 comments on commit b789b15

Please sign in to comment.