diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml index 2454afb9..d76cfd03 100644 --- a/.github/workflows/gradle.yml +++ b/.github/workflows/gradle.yml @@ -5,7 +5,7 @@ # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle -name: Java CI with Gradle +name: Build and publish mod on: push: @@ -47,7 +47,8 @@ jobs: id: build run: ./gradlew build - - name: Publish mod + - name: Publish mod (Optional) + if: ${{ steps.build.outputs.publish_mod == 'true' }} uses: Kir-Antipov/mc-publish@v3.3 with: loaders: forge @@ -94,7 +95,8 @@ jobs: # run: gradle build - name: Upload artifacts + if: ${{ steps.build.outputs.publish_mod != 'true' }} # Upload artifacts only in mod is not published uses: actions/upload-artifact@v4 with: name: divine-favor - path: build/libs + path: build/libs/!(*-@(dev|sources|all)).jar diff --git a/build.gradle b/build.gradle index fa24f808..4992afee 100644 --- a/build.gradle +++ b/build.gradle @@ -47,9 +47,7 @@ repositories { } //logging.level = LogLevel.DEBUG -//def currentReleaseType = getReleaseType() version = "${mod_version}.${generateVersionCode()}" -def localDependencies = getEnvVar('LOCAL_DEPENDENCIES').toBoolean() println "Mod version: $version" println "Release type: $release_type" @@ -152,11 +150,6 @@ static def shExec(command, ignoreEmptyResult = false, ignoreErrors = false) { return result } -static def getEnvVar(varName,fallback = '') { - def value = System.getenv(varName) - return value ? value : fallback -} - idea { module { inheritOutputDirs true @@ -208,6 +201,7 @@ tasks.register('printToGitHubActions') { fw.write("version=${project.version}\n") fw.write("game_versions=${project.minecraft.version}\n") fw.write("release_type=${release_type}\n") + fw.write("publish_mod=${publish_mod}\n") fw.write("github_tag=${mod_archives_base_name}-${project.version}\n") fw.write("name=Divine Favor ${project.version}\n") fw.close() diff --git a/gradle.properties b/gradle.properties index d79a24f0..3ead95fb 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,6 +3,8 @@ mod_version = 1.0 # release or beta release_type = beta +# true of false +publish_mod = false mod_group = aurocosh.divinefavor mod_archives_base_name = divinefavor