Skip to content

Commit 37b4b0b

Browse files
committed
Update Publishing to use new cred method
Signed-off-by: Joseph T. McQuigg <[email protected]>
1 parent a7120b5 commit 37b4b0b

File tree

4 files changed

+33
-10
lines changed

4 files changed

+33
-10
lines changed

fabric/build.gradle.kts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -105,8 +105,8 @@ tasks {
105105

106106
publisher {
107107
apiKeys {
108-
curseforge(project.properties["curseforge_token"].toString())
109-
modrinth(project.properties["modrinth_token"].toString())
108+
curseforge(getPublishingCredentials().first)
109+
modrinth(getPublishingCredentials().second)
110110
github(project.properties["github_token"].toString())
111111
}
112112

@@ -153,9 +153,21 @@ publishing {
153153
url = uri(if (project.version.toString().endsWith("SNAPSHOT") || project.version.toString().startsWith("0")) snapshotsRepoUrl else releasesRepoUrl)
154154
name = "Generations-Repo"
155155
credentials {
156-
username = project.properties["repoLogin"]?.toString()
157-
password = project.properties["repoPassword"]?.toString()
156+
username = getGensCredentials().first
157+
password = getGensCredentials().second
158158
}
159159
}
160160
}
161+
}
162+
163+
private fun getGensCredentials(): Pair<String?, String?> {
164+
val username = (project.findProperty("gensUsername") ?: System.getenv("GENS_USERNAME") ?: "") as String?
165+
val password = (project.findProperty("gensPassword") ?: System.getenv("GENS_PASSWORD") ?: "") as String?
166+
return Pair(username, password)
167+
}
168+
169+
private fun getPublishingCredentials(): Pair<String?, String?> {
170+
val curseForgeToken = (project.findProperty("curseforge_token") ?: System.getenv("CURSEFORGE_TOKEN") ?: "") as String?
171+
val modrinthToken = (project.findProperty("modrinth_token") ?: System.getenv("MODRINTH_TOKEN") ?: "") as String?
172+
return Pair(curseForgeToken, modrinthToken)
161173
}

fabric/src/main/resources/fabric.mod.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"name": "Generations-Core",
77
"description": "",
88
"authors": ["Joseph T. McQuigg (JT122406)", "Waterpicker"],
9+
"contributors": ["Greg_lor"],
910
"contact": {},
1011
"icon": "generations.png",
1112

forge/build.gradle.kts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -113,8 +113,8 @@ tasks {
113113

114114
publisher {
115115
apiKeys {
116-
curseforge(project.properties["curseforge_token"].toString())
117-
modrinth(project.properties["modrinth_token"].toString())
116+
curseforge(getPublishingCredentials().first)
117+
modrinth(getPublishingCredentials().second)
118118
github(project.properties["github_token"].toString())
119119
}
120120

@@ -160,9 +160,21 @@ publishing {
160160
url = uri(if (project.version.toString().endsWith("SNAPSHOT") || project.version.toString().startsWith("0")) snapshotsRepoUrl else releasesRepoUrl)
161161
name = "Generations-Repo"
162162
credentials {
163-
username = project.properties["repoLogin"]?.toString()
164-
password = project.properties["repoPassword"]?.toString()
163+
username = getGensCredentials().first
164+
password = getGensCredentials().second
165165
}
166166
}
167167
}
168+
}
169+
170+
private fun getGensCredentials(): Pair<String?, String?> {
171+
val username = (project.findProperty("gensUsername") ?: System.getenv("GENS_USERNAME") ?: "") as String?
172+
val password = (project.findProperty("gensPassword") ?: System.getenv("GENS_PASSWORD") ?: "") as String?
173+
return Pair(username, password)
174+
}
175+
176+
private fun getPublishingCredentials(): Pair<String?, String?> {
177+
val curseForgeToken = (project.findProperty("curseforge_token") ?: System.getenv("CURSEFORGE_TOKEN") ?: "") as String?
178+
val modrinthToken = (project.findProperty("modrinth_token") ?: System.getenv("MODRINTH_TOKEN") ?: "") as String?
179+
return Pair(curseForgeToken, modrinthToken)
168180
}

gradle.properties

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,4 @@ systemProp.org.gradle.internal.repository.max.tentative=10
4343
systemProp.org.gradle.internal.repository.initial.backoff=500
4444

4545
# Publishing
46-
curseforge_token=xxx
47-
modrinth_token=xxx
4846
github_token=xxx

0 commit comments

Comments
 (0)