Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 72 additions & 0 deletions .github/workflows/publish-jfrog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: Publish Gobley Plugins to JFrog

on:
push:
branches:
- develop
- main
paths:
- 'build-logic/**'
- 'crates/gobley-uniffi-bindgen/Cargo.toml'
- '.github/workflows/publish-jfrog.yml'
workflow_dispatch:

jobs:
publish:
name: Publish Gobley Plugins to JFrog Artifactory
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: false

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'

- name: Grant execute permission for gradlew
run: chmod +x gradlew

- name: Build plugins
run: |
./gradlew :build-logic:gobley-gradle-cargo:build \
:build-logic:gobley-gradle-uniffi:build \
:build-logic:gobley-gradle-rust:build \
:build-logic:gobley-gradle:build \
--no-daemon -x test \
-Pgobley.projects.examples.app=false \
-Pgobley.projects.examples.audioCppApp=false \
-Pgobley.projects.examples.customTypes=false \
-Pgobley.projects.examples.tokioBlake3App=false \
-Pgobley.projects.examples.tokioBoringApp=false \
-Pgobley.projects.gradleTests=false \
-Pgobley.projects.uniffiTests=false \
-Pgobley.projects.uniffiTests.extTypes=false \
-Pgobley.projects.uniffiTests.extTypes=false

- name: Publish to JFrog Artifactory
env:
ORG_GRADLE_PROJECT_artifactoryUser: ${{ secrets.HC_JFROG_USER }}
ORG_GRADLE_PROJECT_artifactoryPassword: ${{ secrets.HC_JFROG_PASSWORD }}
run: |
./gradlew :build-logic:gobley-gradle-cargo:artifactoryPublish \
:build-logic:gobley-gradle-uniffi:artifactoryPublish \
:build-logic:gobley-gradle-rust:artifactoryPublish \
:build-logic:gobley-gradle:artifactoryPublish \
--no-daemon \
-Pgobley.projects.examples.app=false \
-Pgobley.projects.examples.audioCppApp=false \
-Pgobley.projects.examples.customTypes=false \
-Pgobley.projects.examples.tokioBlake3App=false \
-Pgobley.projects.examples.tokioBoringApp=false \
-Pgobley.projects.gradleTests=false \
-Pgobley.projects.uniffiTests=false \
-Pgobley.projects.uniffiTests.extTypes=false

- name: Verify Publication
run: |
echo "✅ Published Gobley plugins to JFrog Artifactory"
echo "Check JFrog Artifactory to verify artifacts:"
echo "https://nedap.jfrog.io/nedap/webapp/#/artifacts/browse/tree/General/libs-releases-local/com/nedap/healthcare/gobley"
1 change: 1 addition & 0 deletions build-logic/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,6 @@ plugins {
alias(libs.plugins.buildconfig) apply false
alias(libs.plugins.vanniktech.maven.publish) apply false
alias(libs.plugins.kotlinx.binary.compatibility.validator) apply false
alias(libs.plugins.jfrog.artifactory) apply false
id("gobley-gradle-build") apply false
}
1 change: 1 addition & 0 deletions build-logic/gobley-gradle-build/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ dependencies {
compileOnly(gradleKotlinDsl())
compileOnly(plugin(libs.plugins.kotlin.jvm))
compileOnly(plugin(libs.plugins.vanniktech.maven.publish))
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:${libs.versions.jfrog.artifactory.get()}")
implementation(libs.kotlinx.serialization.core)
implementation(libs.tomlkt)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,10 @@ import com.vanniktech.maven.publish.MavenPublishBaseExtension
import com.vanniktech.maven.publish.SonatypeHost
import org.gradle.api.Project
import org.gradle.api.tasks.testing.Test
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.withType
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jfrog.gradle.plugin.artifactory.dsl.ArtifactoryPluginConvention

abstract class GobleyGradleBuildExtension(private val project: Project) {
val uniffiBindgenManifest = CargoManifest.fromFile(
Expand Down Expand Up @@ -56,6 +58,7 @@ private fun Project.configureGobleyGradleProject(
}
}
configureMavenCentralPublishing(gradlePlugin, signing)
configureJfrogPublishing()
}

private fun Project.configureProjectProperties(
Expand All @@ -66,7 +69,7 @@ private fun Project.configureProjectProperties(
"../crates/gobley-uniffi-bindgen/Cargo.toml"
).asFile
)
group = "dev.gobley.gradle"
group = "com.nedap.healthcare.gobley"
version = when {
bindgenManifest.version.contains('-') -> bindgenManifest.version.substringBefore('-') + "-SNAPSHOT"
else -> bindgenManifest.version
Expand Down Expand Up @@ -131,6 +134,35 @@ private fun Project.configureMavenCentralPublishing(gradlePlugin: Boolean, signi
}
}

private fun Project.configureJfrogPublishing() {
plugins.apply("com.jfrog.artifactory")

afterEvaluate {
val artifactoryCredentials = getArtifactoryCredentials()
val isSnapshot = version.toString().contains("-SNAPSHOT") || version.toString().contains("-")
val repositoryPath = if (isSnapshot) "libs-snapshots-local" else "libs-releases-local"

extensions.configure<ArtifactoryPluginConvention> {
setContextUrl("https://nedap.jfrog.io/nedap")
publish {
repository {
repoKey = repositoryPath
username = artifactoryCredentials.first
password = artifactoryCredentials.second
}
defaults {
publications("ALL_PUBLICATIONS")
}
}
}
}
}

private fun Project.getArtifactoryCredentials(): Pair<String?, String?> {
return findProperty("artifactoryUser") as String? to
findProperty("artifactoryPassword") as String?
}

private fun Project.propertyOrEnv(propertyName: String, envName: String = propertyName): String? {
return findProperty(propertyName)?.toString()
?: rootProject.findProperty(propertyName)?.toString()
Expand Down
2 changes: 2 additions & 0 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ agp = "8.7.3"

buildconfig = "5.5.1"
vanniktech-maven-publish = "0.31.0"
jfrog-artifactory = "6.0.2"

kotlinx-serialization = "1.7.3"
kotlinx-coroutines = "1.9.0"
Expand Down Expand Up @@ -46,6 +47,7 @@ kotlin-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", versi
kotlinx-binary-compatibility-validator = { id = "org.jetbrains.kotlinx.binary-compatibility-validator", version.ref = "kotlinx-binary-compatibility-validator" }
buildconfig = { id = "com.github.gmazzo.buildconfig", version.ref = "buildconfig" }
vanniktech-maven-publish = { id = "com.vanniktech.maven.publish", version.ref = "vanniktech-maven-publish" }
jfrog-artifactory = { id = "com.jfrog.artifactory", version.ref = "jfrog-artifactory" }

[libraries]

Expand Down