Skip to content

Commit

Permalink
Optional publishing
Browse files Browse the repository at this point in the history
  • Loading branch information
Aurocosh committed Jun 10, 2024
1 parent 2de6a66 commit 98f7896
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 10 deletions.
8 changes: 5 additions & 3 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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/[email protected]
with:
loaders: forge
Expand Down Expand Up @@ -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
8 changes: 1 addition & 7 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand Down
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 98f7896

Please sign in to comment.