diff --git a/.github/workflows/branch-snapshot.yml b/.github/workflows/branch-snapshot.yml index 8ec270c1..40f82991 100644 --- a/.github/workflows/branch-snapshot.yml +++ b/.github/workflows/branch-snapshot.yml @@ -30,7 +30,7 @@ jobs: - name: Publish if: steps.check.outputs.triggered == 'true' env: - PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipAutostyle -PfailIfLibraryMissing -PsnapshotName=${{ github.head_ref }}" + PROPS_RELEASE: "-Prc=1 -Pgh -Prelease=false -PskipJavadoc -PskipAutostyle -PfailIfLibraryMissing -PuseBranchSnapshotName=true" PROPS_GIT: "-PghGitSourceUsername=${{ secrets.GH_GIT_USERNAME }} -PghGitSourcePassword=${{ secrets.GITHUB_TOKEN }}" PROPS_NEXUS: "-PghNexusUsername=${{ secrets.GH_NEXUS_USERNAME }} -PghNexusPassword=${{ secrets.GH_NEXUS_PASSWORD }}" PROPS_SIGNING: "-PuseInMemoryKey=true -Psigning.inMemoryKey=${{ secrets.IN_MEMORY_KEY }} -Psigning.password=${{ secrets.SIGNING_PASSWORD }}" diff --git a/build.gradle.kts b/build.gradle.kts index b3242a26..9770e8dc 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -14,6 +14,7 @@ plugins { id("com.github.vlsi.crlf") id("com.github.vlsi.gradle-extensions") id("com.github.vlsi.stage-vote-release") + id("org.ajoberstar.grgit") } val skipJavadoc by props() @@ -21,7 +22,11 @@ val enableMavenLocal by props(false) val enableGradleMetadata by props() val skipAutostyle by props(false) val isRelease = project.stringProperty("release").toBool() -val snapshotName by props("") +val snapshotName = if (project.props.bool("useBranchSnapshotName")) { + System.getenv("GITHUB_HEAD_REF") ?: grgit.branch.current()?.name +} else { + project.stringProperty("snapshotName") +} ?: "" val String.v: String get() = rootProject.extra["$this.version"] as String val projectVersion = "darklaf".v diff --git a/gradle.properties b/gradle.properties index 7f06ffff..de7b3b8c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,3 +14,4 @@ darklaf.version = 2.6.2 com.github.vlsi.vlsi-release-plugins.version = 1.74 com.github.autostyle.version = 3.1 nokee.version = 0.4.0 +org.ajoberstar.grgit.version = 4.1.0 diff --git a/settings.gradle.kts b/settings.gradle.kts index 4a9dfec0..339107db 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -10,6 +10,7 @@ pluginManagement { idv("com.github.vlsi.gradle-extensions", "com.github.vlsi.vlsi-release-plugins") idv("com.github.vlsi.license-gather", "com.github.vlsi.vlsi-release-plugins") idv("com.github.vlsi.stage-vote-release", "com.github.vlsi.vlsi-release-plugins") + idv("org.ajoberstar.grgit", "org.ajoberstar.grgit") } } rootProject.name = "darklaf"