From 2878cd5bb37f2712848c7e6426ffa460826f0446 Mon Sep 17 00:00:00 2001 From: Patrick Boos Date: Tue, 28 Oct 2025 09:01:38 +0100 Subject: [PATCH] Use github tag for release version (fix) --- .github/workflows/publish.yml | 8 ++++++++ build.gradle | 2 +- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 1d5da543..9b1d0036 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -27,6 +27,13 @@ jobs: uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 with: arguments: sourcesJar javadocJar + - name: Get tag + shell: bash + id: get_tag + run: | + TAG=${GITHUB_REF#refs/tags/} + echo "Github tag: $TAG" + echo "gh_tag=${TAG#v}" >> "$GITHUB_OUTPUT" - name: Publish to MavenCentral uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0 with: @@ -38,3 +45,4 @@ jobs: SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }} SIGNING_KEY: ${{ secrets.SIGNING_KEY }} + GH_TAG: "${{ steps.get_tag.outputs.gh_tag }}" diff --git a/build.gradle b/build.gradle index 22924cf0..b853cce8 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ allprojects { group = 'com.getyourguide.openapi.validation' description = 'OpenAPI Validation library' // Use version from GitHub tag if provided, otherwise use default version - version = project.hasProperty('gh_tag') ? project.property('gh_tag').replaceFirst('^v', '') : '0-SNAPSHOT' + version = System.getenv('GH_TAG') ? System.getenv('GH_TAG').replaceFirst('^v', '') : '0-SNAPSHOT' java { toolchain {