Skip to content

Commit

Permalink
Added github package publishing block (#16)
Browse files Browse the repository at this point in the history
Co-authored-by: Shraddha Dondekar <[email protected]>
  • Loading branch information
DondekarShraddha and ShraddhaDondekar18 authored Aug 26, 2022
1 parent bb28b93 commit 2a22bcd
Show file tree
Hide file tree
Showing 4 changed files with 72 additions and 12 deletions.
48 changes: 39 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apply from: "${scriptDir}/spotless.gradle"

allprojects {
group = "com.logicmonitor"
version = "0.1.0-alpha"
version = "0.0.1-alpha"
}
ext {
versions = [
Expand All @@ -36,14 +36,6 @@ dependencies {
implementation group: "io.opentelemetry", name: "opentelemetry-api", version: "${versions.opentelemetry}"
api group: "io.opentelemetry", name: "opentelemetry-sdk-extension-autoconfigure", version: "${versions.opentelemetryAlpha}"
}
publishing {
publications {
maven(MavenPublication) {
artifactId = 'lm-opentelemetry-sdk'
from components.java
}
}
}

test {
useJUnitPlatform()
Expand Down Expand Up @@ -73,3 +65,41 @@ codeCoverageReport.dependsOn {
}.findAll();

}

task jarSigner {
doLast {
def passwd = System.getenv("PASSWORD")
def app_alias = System.getenv("ALIAS")
def pfx_file = System.getenv("FILE")
def storetype = System.getenv("STORETYPE")

def exec_line = "jarsigner -storetype " + storetype + " -keystore " + pfx_file + " -tsa http://timestamp.comodoca.com/?td=sha256 -storepass " +
passwd + " -keypass "+ passwd + " " + jar.archivePath + " " + app_alias

def output=exec_line.execute()
output.waitFor()

println "Exit value: ${output.exitValue()}"
println "Output: ${output.text}"
}
}
jar.finalizedBy(jarSigner)

publishing {
publications {
mavenJava(MavenPublication) {
artifactId = 'lm-telemetry-sdk'
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/logicmonitor/lm-telemetry-sdk-java"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}
2 changes: 1 addition & 1 deletion lm-javaagent-layer/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ task copyAgentJar(type: Copy, dependsOn: [':lm-agent:agent:shadowJar']) {
}

task createlayer(type: Zip, dependsOn: ['copyAgentJar']) {
archiveFileName = 'lm-opentelemetry-javaagent-layer.zip'
archiveFileName = 'lm-telemetry-javaagent-layer.zip'
destinationDirectory = file("$buildDir/distributions")
def srcPath = "$buildDir/libs"
from(srcPath) {
Expand Down
32 changes: 31 additions & 1 deletion otel-resource/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,44 @@ dependencies {
testImplementation group: 'org.junit-pioneer', name: 'junit-pioneer', version: '0.7.0'
}

task jarSigner {
doLast {
def passwd = System.getenv("PASSWORD")
def app_alias = System.getenv("ALIAS")
def pfx_file = System.getenv("FILE")
def storetype = System.getenv("STORETYPE")

def exec_line = "jarsigner -storetype " + storetype + " -keystore " + pfx_file + " -tsa http://timestamp.comodoca.com/?td=sha256 -storepass " +
passwd + " -keypass "+ passwd + " " + jar.archivePath + " " + app_alias

def output=exec_line.execute()
output.waitFor()

println "Exit value: ${output.exitValue()}"
println "Output: ${output.text}"
}
}
jar.finalizedBy(jarSigner)

publishing {
publications {
maven(MavenPublication) {
mavenJava(MavenPublication) {
artifactId = 'otel-resource'
from components.java
}
}
repositories {
maven {
name = "GitHubPackages"
url = "https://maven.pkg.github.com/logicmonitor/lm-telemetry-sdk-java"
credentials {
username = System.getenv("GITHUB_ACTOR")
password = System.getenv("GITHUB_TOKEN")
}
}
}
}

test {
useJUnitPlatform()
}
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
rootProject.name = 'lm-opentelemetry-sdk'
rootProject.name = 'lm-telemetry-sdk-java'
include 'otel-resource'
include 'lm-agent'
include 'lm-agent:custom'
Expand Down

0 comments on commit 2a22bcd

Please sign in to comment.