Skip to content

Commit f90481c

Browse files
committed
build: always declare all publishing repos in gradle
Instead of conditionally defining maven target repositories depending on the availability of credentials, always declare them. Users can still select to which repository they want to publish by means of the automatically created gradle tasks using the Maven repository names such as publishFooToGithubPackagesRepository. This changes makes it easier to figure out configuration problems for the passed in credentials. Instead of simply skipping publishing because the repo was not created on demand, now an explicit authentication failure will be reported.
1 parent 81d16c3 commit f90481c

File tree

1 file changed

+29
-34
lines changed

1 file changed

+29
-34
lines changed

build.gradle.kts

Lines changed: 29 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -37,42 +37,37 @@ subprojects {
3737

3838
publishing {
3939
repositories {
40-
if (project.hasProperty("artifacts.itemis.cloud.user")) {
41-
maven {
42-
name = "itemis"
43-
url = if (version.toString().contains("SNAPSHOT"))
44-
uri("https://artifacts.itemis.cloud/repository/maven-mps-snapshots/")
45-
else
46-
uri("https://artifacts.itemis.cloud/repository/maven-mps-releases/")
47-
credentials {
48-
username = project.findProperty("artifacts.itemis.cloud.user").toString()
49-
password = project.findProperty("artifacts.itemis.cloud.pw").toString()
50-
}
40+
maven {
41+
name = "itemis"
42+
url = if (version.toString().contains("SNAPSHOT")) {
43+
uri("https://artifacts.itemis.cloud/repository/maven-mps-snapshots/")
44+
} else {
45+
uri("https://artifacts.itemis.cloud/repository/maven-mps-releases/")
46+
}
47+
credentials {
48+
username = project.findProperty("artifacts.itemis.cloud.user").toString()
49+
password = project.findProperty("artifacts.itemis.cloud.pw").toString()
5150
}
5251
}
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-
}
52+
maven {
53+
name = "GitHubPackages"
54+
// we moved some components from modelix/modelix to modelix/modelix.core but github packages
55+
// cannot handle this situation. basically we suffer from what is described here:
56+
// https://github.com/orgs/community/discussions/23474
57+
// this is a simple workaround for the affected components.
58+
// consequently, when obtaining these dependencies, the repo url is the old modelix/modelix one...
59+
if (project.name in arrayOf("model-client",
60+
"model-client-js",
61+
"model-client-jvm",
62+
"model-server",
63+
"model-server-api")) {
64+
url = uri("https://maven.pkg.github.com/modelix/modelix")
65+
} else {
66+
url = uri("https://maven.pkg.github.com/modelix/modelix.core")
67+
}
68+
credentials {
69+
username = project.findProperty("gpr.user") as? String ?: System.getenv("GITHUB_ACTOR")
70+
password = project.findProperty("gpr.key") as? String ?: System.getenv("GITHUB_TOKEN")
7671
}
7772
}
7873
}

0 commit comments

Comments
 (0)