diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7866f5..f3b20d0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,8 +20,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 - name: Set up Java uses: actions/setup-java@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 4139dc0..1dade9b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,6 +18,7 @@ jobs: uses: actions/checkout@v4 with: fetch-depth: 0 + - run: git fetch --tags --force origin #workaround https://github.com/actions/checkout/issues/882 - name: Set up Java uses: actions/setup-java@v4 with: diff --git a/.github/workflows/upload-dependency-graph.yml b/.github/workflows/upload-dependency-graph.yml index 36f91f4..ca20b78 100644 --- a/.github/workflows/upload-dependency-graph.yml +++ b/.github/workflows/upload-dependency-graph.yml @@ -13,8 +13,6 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - with: - fetch-depth: 0 - uses: actions/setup-java@v4 with: distribution: temurin diff --git a/build.gradle.kts b/build.gradle.kts index 7c1124c..2158784 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -5,20 +5,12 @@ import org.jreleaser.model.UpdateSection plugins { `java-library` alias(libs.plugins.spotless) - alias(libs.plugins.gradle.semver) + alias(libs.plugins.jgitver) alias(libs.plugins.jreleaser) } -semver { - tagPrefix("v") - initialVersion("0.0.0") - findProperty("semver.overrideVersion")?.toString()?.let { overrideVersion(it) } -} - project.group = "info.usmans.tools" -version = semver.version // project version, also used for jreleaser - repositories { // Use Maven Central for resolving dependencies. mavenCentral() @@ -53,6 +45,8 @@ spotless { kotlinGradle { ktfmt() } } +jgitver { nonQualifierBranches = "main" } + tasks.register("printVersion") { group = "Help" description = "Prints the project version" diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 31b4b80..36fba47 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -8,8 +8,8 @@ junit-jupiter = "5.10.2" spotless = "6.25.0" slf4j = "2.0.13" bouncy-castle = "1.78.1" +jgitver = "0.10.0-rc03" jreleaser = "1.13.1" -figure-gradle-semver = "1.10.0" [libraries] junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "junit-jupiter" } @@ -19,5 +19,5 @@ bcprov = { module = "org.bouncycastle:bcprov-jdk18on", version.ref = "bouncy-cas [plugins] spotless = { id = "com.diffplug.spotless", version.ref = "spotless" } -gradle-semver = { id = "com.figure.gradle.semver-plugin", version.ref = "figure-gradle-semver" } +jgitver = { id = "fr.brouillard.oss.gradle.jgitver", version.ref = "jgitver" } jreleaser = { id = "org.jreleaser", version.ref = "jreleaser"} \ No newline at end of file