diff --git a/.github/workflows/publish-github-packages.yml b/.github/workflows/publish-github-packages.yml index f6d9bd6..0e534bf 100644 --- a/.github/workflows/publish-github-packages.yml +++ b/.github/workflows/publish-github-packages.yml @@ -46,11 +46,6 @@ jobs: # 2. Add it as a repository secret (e.g., PACKAGES_TOKEN) # 3. Use that secret instead of GITHUB_TOKEN # - # The current version is hardcoded in lib/build.gradle.kts as "1.0.0" - # For dynamic versioning, consider: - # 1. Using the git tag (${GITHUB_REF#refs/tags/}) - # 2. Reading version from gradle.properties - # 3. Using a gradle plugin like 'axion-release-plugin' - name: Publish to GitHub Packages env: USERNAME: ${{ github.actor }} # GitHub username of the user/bot triggering the workflow diff --git a/gradle.properties b/gradle.properties index b06a80a..e801d86 100644 --- a/gradle.properties +++ b/gradle.properties @@ -5,3 +5,6 @@ org.gradle.caching=true # (Note that some plugins may not yet be compatible with the configuration cache.) # https://docs.gradle.org/current/userguide/configuration_cache.html org.gradle.configuration-cache=true + +# Library version for maven publishing +version=1.0.0 diff --git a/lib/build.gradle.kts b/lib/build.gradle.kts index 80ccc83..1e68f5c 100644 --- a/lib/build.gradle.kts +++ b/lib/build.gradle.kts @@ -36,7 +36,7 @@ publishing { register("maven") { groupId = "hossain.dev" artifactId = "json5kt" - version = "1.0.0" + version = project.findProperty("version") as String? ?: "1.0.0" from(components["java"]) artifact(sourcesJar)