Skip to content

Commit 6498bd0

Browse files
Update versioning in build.gradle and enhance release workflow
- Updated the version in build.gradle to dynamically retrieve from Git tags, defaulting to '0.1.1'. - Modified the GitHub Actions release workflow to automatically update the version in build.gradle based on the tag during the release process.
1 parent 58c7eb7 commit 6498bd0

2 files changed

Lines changed: 11 additions & 6 deletions

File tree

.github/workflows/release.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ jobs:
1818
ref: main
1919
fetch-depth: 0
2020

21+
- name: Extract version from tag
22+
id: get_version
23+
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
24+
25+
- name: Update build.gradle version from tag
26+
run: |
27+
VERSION=${{ steps.get_version.outputs.VERSION }}
28+
sed -i "s/^version = '[0-9]\+\.[0-9]\+\.[0-9]\+'$/version = '${VERSION}'/" build.gradle
29+
2130
- name: Set up JDK 21
2231
uses: actions/setup-java@v4
2332
with:
@@ -31,10 +40,6 @@ jobs:
3140
- name: Build with Gradle
3241
run: ./gradlew build
3342

34-
- name: Extract version from tag
35-
id: get_version
36-
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_OUTPUT
37-
3843
- name: Validate Maven Central credentials
3944
run: |
4045
if [ -z "${{ secrets.MAVEN_CENTRAL_TOKEN }}" ]; then
@@ -65,7 +70,7 @@ jobs:
6570
run: |
6671
git config user.name "github-actions[bot]"
6772
git config user.email "github-actions[bot]@users.noreply.github.com"
68-
git add README.md
73+
git add README.md build.gradle
6974
git diff --staged --quiet || git commit -m "docs: update version to ${{ steps.get_version.outputs.VERSION }} in README"
7075
git push origin main
7176
env:

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
}
66

77
group = 'com.felipestanzani'
8-
version = '0.1.0'
8+
version = findProperty('version') ?: '0.1.1'
99
description = 'Token-Oriented Object Notation (TOON) - A compact, human-readable format for LLM contexts'
1010

1111
// Apply external Gradle scripts

0 commit comments

Comments
 (0)