Skip to content

Commit 2878cd5

Browse files
committed
Use github tag for release version (fix)
1 parent fe8cd0d commit 2878cd5

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,13 @@ jobs:
2727
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
2828
with:
2929
arguments: sourcesJar javadocJar
30+
- name: Get tag
31+
shell: bash
32+
id: get_tag
33+
run: |
34+
TAG=${GITHUB_REF#refs/tags/}
35+
echo "Github tag: $TAG"
36+
echo "gh_tag=${TAG#v}" >> "$GITHUB_OUTPUT"
3037
- name: Publish to MavenCentral
3138
uses: gradle/gradle-build-action@a8f75513eafdebd8141bd1cd4e30fcd194af8dfa # v2.12.0
3239
with:
@@ -38,3 +45,4 @@ jobs:
3845
SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }}
3946
SIGNING_PASSWORD: ${{ secrets.SIGNING_PASSWORD }}
4047
SIGNING_KEY: ${{ secrets.SIGNING_KEY }}
48+
GH_TAG: "${{ steps.get_tag.outputs.gh_tag }}"

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ allprojects {
1313
group = 'com.getyourguide.openapi.validation'
1414
description = 'OpenAPI Validation library'
1515
// Use version from GitHub tag if provided, otherwise use default version
16-
version = project.hasProperty('gh_tag') ? project.property('gh_tag').replaceFirst('^v', '') : '0-SNAPSHOT'
16+
version = System.getenv('GH_TAG') ? System.getenv('GH_TAG').replaceFirst('^v', '') : '0-SNAPSHOT'
1717

1818
java {
1919
toolchain {

0 commit comments

Comments
 (0)