diff --git a/.github/workflows/deploy-snapshot.yml b/.github/workflows/deploy-snapshot.yml index 752634c..4ce494a 100644 --- a/.github/workflows/deploy-snapshot.yml +++ b/.github/workflows/deploy-snapshot.yml @@ -28,10 +28,10 @@ jobs: cache-disabled: false - name: "Build artifacts" - run: ./gradlew build -Pversion_pre_release=${{ github.run_number }} --full-stacktrace + run: ./gradlew build -Psnapshot=true --full-stacktrace - name: "Publish artifacts" - run: ./gradlew publish -Pversion_pre_release=${{ github.run_number }} + run: ./gradlew publish -Psnapshot=true --full-stacktrace env: ALPINE_MAVEN_NAME: ${{ secrets.ALPINE_MAVEN_NAME }} ALPINE_MAVEN_SECRET: ${{ secrets.ALPINE_MAVEN_SECRET }} diff --git a/build.gradle.kts b/build.gradle.kts index 3cfe9af..0838e0a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -191,7 +191,7 @@ publishing { repositories { maven { name = "AlpineCloud" - url = uri("https://lib.alpn.cloud" + if (isRelease()) "/alpine-public" else "/snapshots") + url = uri("https://lib.alpn.cloud" + if (isSnapshot()) "/snapshots" else "/alpine-public") credentials { username = System.getenv("ALPINE_MAVEN_NAME") password = System.getenv("ALPINE_MAVEN_SECRET") @@ -224,8 +224,8 @@ subprojects { } } -fun isRelease(): Boolean { - return project.properties["version_pre_release"] == null +fun isSnapshot(): Boolean { + return (project.findProperty("snapshot") as? String)?.toBoolean() ?: false } fun compileGroup(): String { @@ -236,8 +236,7 @@ fun compileVersion(): String { val major = project.properties["version_major"] val minor = project.properties["version_minor"] val patch = project.properties["version_patch"] - val preRelease = project.properties["version_pre_release"] - return "${major}.${minor}.${patch}${if (isRelease()) "" else "-SNAPSHOT-${preRelease}"}" + return "${major}.${minor}.${patch}${if (isSnapshot()) "-SNAPSHOT" else ""}" } fun shade(scope: DependencyHandlerScope, dependency: String) {