Skip to content

Commit d6cc17a

Browse files
committed
Another attempt at fixing publishing
1 parent c42eac4 commit d6cc17a

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

.github/workflows/build_and_publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ jobs:
2929
env:
3030
ORG_GRADLE_PROJECT_OSSRH_USERNAME: Bearer ${{ secrets.OSSRH_USERNAME }}
3131
ORG_GRADLE_PROJECT_OSSRH_PASSWORD: Bearer ${{ secrets.OSSRH_PASSWORD }}
32+
ORG_GRADLE_PROJECT_centralAuthHeaderName: Authorization
33+
ORG_GRADLE_PROJECT_centralAuthHeaderValue: Bearer ${{ secrets.CENTRAL_AUTH_TOKEN }}
3234
run: ./gradlew build publish
3335
- uses: actions/upload-artifact@v4
3436
with:

CubicChunksAPI/build.gradle.kts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -241,13 +241,19 @@ publishing {
241241

242242
setUrl(if (local) localUrl else if (doRelease.toBoolean()) releasesRepoUrl else snapshotsRepoUrl)
243243
if (!local) {
244-
credentials {
245-
username = ossrhMavenUsername
246-
password = ossrhMavenPassword
244+
if (doRelease.toBoolean()) {
245+
credentials {
246+
username = ossrhMavenUsername
247+
password = ossrhMavenPassword
248+
}
249+
} else {
250+
credentials(HttpHeaderCredentials::class)
251+
authentication {
252+
create<HttpHeaderAuthentication>("header")
253+
}
247254
}
248255
}
249256
}
250-
251257
//only register maven.daporkchop.net repository if these environment variables are set
252258
val daporkchopMavenUsername = (project.properties["daporkchopMavenUsername"] ?: System.getenv("daporkchopMavenUsername")) as String?
253259
val daporkchopMavenPassword = (project.properties["daporkchopMavenPassword"] ?: System.getenv("daporkchopMavenPassword")) as String?

build.gradle.kts

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -414,9 +414,16 @@ publishing {
414414

415415
setUrl(if (local) localUrl else if (doRelease.toBoolean()) releasesRepoUrl else snapshotsRepoUrl)
416416
if (!local) {
417-
credentials {
418-
username = ossrhMavenUsername
419-
password = ossrhMavenPassword
417+
if (doRelease.toBoolean()) {
418+
credentials {
419+
username = ossrhMavenUsername
420+
password = ossrhMavenPassword
421+
}
422+
} else {
423+
credentials(HttpHeaderCredentials::class)
424+
authentication {
425+
create<HttpHeaderAuthentication>("header")
426+
}
420427
}
421428
}
422429
}

0 commit comments

Comments
 (0)