Skip to content

Commit

Permalink
build: don't publish release to hangar in dev build job
Browse files Browse the repository at this point in the history
  • Loading branch information
kernitus committed Oct 28, 2024
1 parent 468a126 commit 35fe525
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,12 @@ jobs:
with:
gradle-version: wrapper

- name: Determine if this is a release version
run: |
IS_RELEASE=$(./gradlew -q printIsRelease)
echo "Is release? $IS_RELEASE"
echo "IS_RELEASE=$IS_RELEASE" >> $GITHUB_ENV
- name: Run Gradle Build
run: |
./gradlew clean build
Expand All @@ -44,7 +50,7 @@ jobs:
path: build/libs/OldCombatMechanics.jar

- name: Publish Snapshot to Hangar
if: ${{ github.event_name == 'push' && github.event.pull_request == null }}
if: ${{ github.event_name == 'push' && github.event.pull_request == null && env.IS_RELEASE != 'true' }}
env:
HANGAR_API_TOKEN: ${{ secrets.HANGAR_API_TOKEN }}
run: |
Expand Down
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ dependencies {
}

group = "kernitus.plugin.OldCombatMechanics"
version = "2.0.4" // x-release-please-version
version = "2.0.5-beta" // x-release-please-version
description = "OldCombatMechanics"

java {
Expand Down Expand Up @@ -155,6 +155,13 @@ val suffixedVersion: String = if (isRelease) {
// Use the latest commit message for the changelog
val changelogContent: String = latestCommitMessage()

tasks.register("printIsRelease") {
doLast {
val isRelease = !project.version.toString().contains('-')
println(if (isRelease) "true" else "false")
}
}

hangarPublish {
publications.register("plugin") {
version.set(suffixedVersion)
Expand Down

0 comments on commit 35fe525

Please sign in to comment.