Skip to content

Commit 4747a03

Browse files
authored
Merge pull request #23 from hossain-khan/copilot/fix-22
Use gradle.properties for library version in maven release
2 parents fcf43ee + 02b3214 commit 4747a03

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

.github/workflows/publish-github-packages.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -46,11 +46,6 @@ jobs:
4646
# 2. Add it as a repository secret (e.g., PACKAGES_TOKEN)
4747
# 3. Use that secret instead of GITHUB_TOKEN
4848
#
49-
# The current version is hardcoded in lib/build.gradle.kts as "1.0.0"
50-
# For dynamic versioning, consider:
51-
# 1. Using the git tag (${GITHUB_REF#refs/tags/})
52-
# 2. Reading version from gradle.properties
53-
# 3. Using a gradle plugin like 'axion-release-plugin'
5449
- name: Publish to GitHub Packages
5550
env:
5651
USERNAME: ${{ github.actor }} # GitHub username of the user/bot triggering the workflow

gradle.properties

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,3 +5,6 @@ org.gradle.caching=true
55
# (Note that some plugins may not yet be compatible with the configuration cache.)
66
# https://docs.gradle.org/current/userguide/configuration_cache.html
77
org.gradle.configuration-cache=true
8+
9+
# Library version for maven publishing
10+
version=1.0.0

lib/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ publishing {
3636
register<MavenPublication>("maven") {
3737
groupId = "hossain.dev"
3838
artifactId = "json5kt"
39-
version = "1.0.0"
39+
version = project.findProperty("version") as String? ?: "1.0.0"
4040

4141
from(components["java"])
4242
artifact(sourcesJar)

0 commit comments

Comments
 (0)