From dc7c01e1ae6b2de393d954ec24bdff9164cd255f Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Tue, 10 Sep 2024 16:26:37 +0200 Subject: [PATCH 1/3] build: update the way secrets are injected for publishing The old way was broken with config cache. See https://docs.gradle.org/current/samples/sample_publishing_credentials.html And see https://github.com/gradle/gradle/issues/24040 --- .github/workflows/publish-release.yml | 8 +++++--- CHANGELOG.md | 4 ++++ refinedarchitect-plugin/build.gradle.kts | 4 ---- refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt | 8 -------- refinedarchitect-versioning/build.gradle.kts | 4 ---- 5 files changed, 9 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 053345e..1b144fe 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -98,9 +98,11 @@ jobs: - name: Publish to Maven run: ./gradlew publish env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - CREEPERHOST_MAVEN_USERNAME: ${{ secrets.CREEPERHOST_MAVEN_USERNAME }} - CREEPERHOST_MAVEN_TOKEN: ${{ secrets.CREEPERHOST_MAVEN_TOKEN }} + # https://docs.gradle.org/current/samples/sample_publishing_credentials.html#header + ORG_GRADLE_PROJECT_GitHubPackagesUsername: ${{ env.GITHUB_ACTOR }} + ORG_GRADLE_PROJECT_GitHubPackagesPassword: ${{ secrets.GITHUB_TOKEN }} + ORG_GRADLE_PROJECT_CreeperHostUsername: ${{ secrets.CREEPERHOST_MAVEN_USERNAME }} + ORG_GRADLE_PROJECT_CreeperHostPassword: ${{ secrets.CREEPERHOST_MAVEN_TOKEN }} publish-javadoc: name: Publish Javadoc diff --git a/CHANGELOG.md b/CHANGELOG.md index 7a9f1c0..6b1a54f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,10 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Fixed + +- Fixed publishing not working with the config cache. + ## [0.19.0] - 2024-09-10 ### Added diff --git a/refinedarchitect-plugin/build.gradle.kts b/refinedarchitect-plugin/build.gradle.kts index b21b6ae..570c27c 100644 --- a/refinedarchitect-plugin/build.gradle.kts +++ b/refinedarchitect-plugin/build.gradle.kts @@ -38,10 +38,6 @@ publishing { maven { name = "GitHubPackages" url = project.uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } } } } diff --git a/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt b/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt index 0533f1d..713b2ef 100644 --- a/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt +++ b/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt @@ -103,18 +103,10 @@ open class BaseExtension(private val project: Project) { maven { name = "GitHubPackages" url = project.uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } } maven { name = "CreeperHost" url = project.uri("https://maven.creeperhost.net/release") - credentials { - username = System.getenv("CREEPERHOST_MAVEN_USERNAME") - password = System.getenv("CREEPERHOST_MAVEN_TOKEN") - } } } publications { diff --git a/refinedarchitect-versioning/build.gradle.kts b/refinedarchitect-versioning/build.gradle.kts index e2348be..785d395 100644 --- a/refinedarchitect-versioning/build.gradle.kts +++ b/refinedarchitect-versioning/build.gradle.kts @@ -46,10 +46,6 @@ publishing { maven { name = "GitHubPackages" url = project.uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } } } publications { From cbe3235b9a6808b2d4baea3d386e1dffc750fb90 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Tue, 10 Sep 2024 16:34:09 +0200 Subject: [PATCH 2/3] build: disable config cache on releases Reverts the way of working in dc7c01e1. We don't want secrets to be stored in the config cache, so disable the cache in those cases. This reverts commit dc7c01e1ae6b2de393d954ec24bdff9164cd255f. --- .github/workflows/publish-release.yml | 14 ++++++-------- refinedarchitect-plugin/build.gradle.kts | 4 ++++ .../src/main/kotlin/BaseExtension.kt | 8 ++++++++ refinedarchitect-versioning/build.gradle.kts | 4 ++++ 4 files changed, 22 insertions(+), 8 deletions(-) diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 1b144fe..c82ea53 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -96,13 +96,11 @@ jobs: - name: Setup Java uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop - name: Publish to Maven - run: ./gradlew publish + run: ./gradlew --no-configuration-cache publish env: - # https://docs.gradle.org/current/samples/sample_publishing_credentials.html#header - ORG_GRADLE_PROJECT_GitHubPackagesUsername: ${{ env.GITHUB_ACTOR }} - ORG_GRADLE_PROJECT_GitHubPackagesPassword: ${{ secrets.GITHUB_TOKEN }} - ORG_GRADLE_PROJECT_CreeperHostUsername: ${{ secrets.CREEPERHOST_MAVEN_USERNAME }} - ORG_GRADLE_PROJECT_CreeperHostPassword: ${{ secrets.CREEPERHOST_MAVEN_TOKEN }} + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + CREEPERHOST_MAVEN_USERNAME: ${{ secrets.CREEPERHOST_MAVEN_USERNAME }} + CREEPERHOST_MAVEN_TOKEN: ${{ secrets.CREEPERHOST_MAVEN_TOKEN }} publish-javadoc: name: Publish Javadoc @@ -164,7 +162,7 @@ jobs: - name: Setup Java uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop - name: Deploy to CurseForge - run: ./gradlew publishCurseforge + run: ./gradlew --no-configuration-cache publishCurseforge deploy-modrinth: name: Deploy to Modrinth @@ -181,7 +179,7 @@ jobs: - name: Setup Java uses: refinedmods/refinedarchitect/.github/actions/setup-java@develop - name: Deploy to Modrinth - run: ./gradlew publishModrinth + run: ./gradlew --no-configuration-cache publishModrinth announce-discord: name: Announce to Discord diff --git a/refinedarchitect-plugin/build.gradle.kts b/refinedarchitect-plugin/build.gradle.kts index 570c27c..b21b6ae 100644 --- a/refinedarchitect-plugin/build.gradle.kts +++ b/refinedarchitect-plugin/build.gradle.kts @@ -38,6 +38,10 @@ publishing { maven { name = "GitHubPackages" url = project.uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } } } diff --git a/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt b/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt index 713b2ef..0533f1d 100644 --- a/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt +++ b/refinedarchitect-plugin/src/main/kotlin/BaseExtension.kt @@ -103,10 +103,18 @@ open class BaseExtension(private val project: Project) { maven { name = "GitHubPackages" url = project.uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } maven { name = "CreeperHost" url = project.uri("https://maven.creeperhost.net/release") + credentials { + username = System.getenv("CREEPERHOST_MAVEN_USERNAME") + password = System.getenv("CREEPERHOST_MAVEN_TOKEN") + } } } publications { diff --git a/refinedarchitect-versioning/build.gradle.kts b/refinedarchitect-versioning/build.gradle.kts index 785d395..e2348be 100644 --- a/refinedarchitect-versioning/build.gradle.kts +++ b/refinedarchitect-versioning/build.gradle.kts @@ -46,6 +46,10 @@ publishing { maven { name = "GitHubPackages" url = project.uri("https://maven.pkg.github.com/" + System.getenv("GITHUB_REPOSITORY")) + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } } } publications { From 7eb889e501ae25a145551f795c13a2d336429785 Mon Sep 17 00:00:00 2001 From: raoulvdberge Date: Tue, 10 Sep 2024 14:44:19 +0000 Subject: [PATCH 3/3] chore: prepare release v0.19.1 --- CHANGELOG.md | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6b1a54f..23c8d45 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [0.19.1] - 2024-09-10 + ### Fixed - Fixed publishing not working with the config cache. @@ -388,7 +390,9 @@ to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). - Gradle helpers for Fabric and Forge projects. - CI workflows. -[Unreleased]: https://github.com/refinedmods/refinedarchitect/compare/v0.19.0...HEAD +[Unreleased]: https://github.com/refinedmods/refinedarchitect/compare/v0.19.1...HEAD + +[0.19.1]: https://github.com/refinedmods/refinedarchitect/compare/v0.19.0...v0.19.1 [0.19.0]: https://github.com/refinedmods/refinedarchitect/compare/v0.18.0...v0.19.0