Skip to content

Commit 8b9f216

Browse files
committed
build: enable publish to GHP
1 parent 57cc09d commit 8b9f216

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

.github/workflows/publish.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ jobs:
2727
- name: Use tag as version
2828
run: echo "${GITHUB_REF#refs/*/}" > version.txt
2929
- name: Build and Publish Artifacts
30-
run: ./gradlew build publish -PciBuild=true -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} -Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}}
30+
run: ./gradlew build publish -PciBuild=true -Partifacts.itemis.cloud.user=${{secrets.ARTIFACTS_ITEMIS_CLOUD_USER}} -Partifacts.itemis.cloud.pw=${{secrets.ARTIFACTS_ITEMIS_CLOUD_PW}} -PGITHUB_ACTOR=${{ github.actor }} -PGITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
3131
env:
3232
NODE_AUTH_TOKEN: ${{ secrets.ARTIFACTS_ITEMIS_CLOUD_NPM_TOKEN }}
3333
- name: Set up QEMU

build.gradle.kts

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
plugins {
32
kotlin("multiplatform") apply false
43
kotlin("plugin.serialization") apply false
@@ -20,7 +19,7 @@ fun computeVersion(): Any {
2019
return if (versionFile.exists()) {
2120
versionFile.readText().trim()
2221
} else {
23-
gitVersion().let{ if (it.endsWith("-SNAPSHOT")) it else "$it-SNAPSHOT" }.also { versionFile.writeText(it) }
22+
gitVersion().let { if (it.endsWith("-SNAPSHOT")) it else "$it-SNAPSHOT" }.also { versionFile.writeText(it) }
2423
}
2524
}
2625

@@ -51,10 +50,35 @@ subprojects {
5150
}
5251
}
5352
}
53+
val ghp_username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
54+
val ghp_password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
55+
if (ghp_username != null && ghp_password != null) {
56+
maven {
57+
name = "GitHubPackages"
58+
// we moved some components from modelix/modelix to modelix/modelix.core but github packages
59+
// cannot handle this situation. basically we suffer from what is described here:
60+
// https://github.com/orgs/community/discussions/23474
61+
// this is a simple workaround for the affected components.
62+
// consequently, when obtaining these dependencies, the repo url is the old modelix/modelix one...
63+
if (project.name in arrayOf("model-client",
64+
"model-client-js",
65+
"model-client-jvm",
66+
"model-server",
67+
"model-server-api")) {
68+
url = uri("https://maven.pkg.github.com/modelix/modelix")
69+
} else {
70+
url = uri("https://maven.pkg.github.com/modelix/modelix.core")
71+
}
72+
credentials {
73+
username = ghp_username
74+
password = ghp_password
75+
}
76+
}
77+
}
5478
}
5579
}
5680
}
5781

5882
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask> {
5983
dependsOn(":ts-model-api:npm_run_build")
60-
}
84+
}

0 commit comments

Comments
 (0)