Skip to content

Commit

Permalink
Added gradle task for versioning and edited workflows (#1986)
Browse files Browse the repository at this point in the history
  • Loading branch information
krossgg authored Sep 20, 2024
1 parent f4a01cb commit f315e99
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 8 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/auto-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ jobs:
- name: Get Version
id: var
run: |
MESSAGE=$(ls build/libs/* | grep dev.jar -v | grep sources.jar -v | grep slim.jar -v | awk -F 'gtceu-|-SNAPSHOT.jar' '{print $2}')
mv "build/libs/gtceu-$MESSAGE-SNAPSHOT.jar" "build/libs/gtceu-$MESSAGE-build_${{ github.run_number }}-SNAPSHOT.jar"
mv "build/libs/gtceu-$MESSAGE-SNAPSHOT-slim.jar" "build/libs/gtceu-$MESSAGE-build_${{ github.run_number }}-SNAPSHOT-slim.jar"
echo "version=$MESSAGE-build_${{ github.run_number }}" >> $GITHUB_OUTPUT
VER=$(./gradlew -q printVersion)
BUILD_VER=$VER-build_${{ github.run_number }}
for jar in ./build/libs/*; do mv "$jar" "${jar/${VER}-SNAPSHOT/${BUILD_VER}-SNAPSHOT}";done 2>/dev/null
echo "version=$BUILD_VER" >> $GITHUB_OUTPUT
- name: Release
id: release
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/auto-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,7 @@ jobs:
- if: ${{ inputs.publishCurseForgeAndModrinth }}
name: Get Version
id: var
run: |
MESSAGE=$(ls build/libs/* | grep dev.jar -v | grep sources.jar -v | grep shadow.jar -v | grep slim.jar -v | awk -F 'gtceu-|.jar' '{print $2}')
echo version=$MESSAGE >> $GITHUB_OUTPUT
run: echo "version=$(./gradlew -q printVersion)" >> $GITHUB_OUTPUT

- if: ${{ inputs.publishCurseForgeAndModrinth }}
name: mc-publish-forge
Expand Down
2 changes: 1 addition & 1 deletion gradle/scripts/publishing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ publishing {
mavenJava(MavenPublication) {
groupId = project.maven_group
artifactId = project.archivesBaseName
version = project.mod_version
version = project.version

from components.java

Expand Down
6 changes: 6 additions & 0 deletions gradle/scripts/resources.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,12 @@ def mod_description = getConfig("mod_description")
def mod_url = getConfig("mod_url")
def mod_issue_tracker = getConfig("mod_issue_tracker")

task printVersion {
doLast {
println libs.versions.minecraft.get() + "-" + mod_version
}
}

// This block of code expands all declared replace properties in the specified resource targets.
// A missing property will result in an error. Properties are expanded using ${} Groovy notation.
var generateModMetadata = tasks.register("generateModMetadata", ProcessResources) {
Expand Down

0 comments on commit f315e99

Please sign in to comment.