Update github workflows

- Add release workflow
- Add build numbers on action
This commit is contained in:
tibs 2022-01-17 16:20:25 -05:00
parent 38dd1d6ae7
commit 3c13e63e40
Signed by untrusted user who does not match committer: tibs
GPG key ID: 047833989F50F88F
3 changed files with 55 additions and 2 deletions

View file

@ -1,12 +1,14 @@
plugins {
id 'fabric-loom' version '0.10.+'
id 'io.github.juuxel.loom-quiltflower-mini' version '1.2.1'
id 'org.ajoberstar.grgit' version '4.1.0'
}
sourceCompatibility = '17'
targetCompatibility = '17'
version = project.mod_version
archivesBaseName = project.archives_base_name
version = "${project.mod_version}${getVersionMetadata()}"
group = project.maven_group
repositories {
@ -65,3 +67,27 @@ jar {
rename { "${it}_${project.archivesBaseName}"}
}
}
def getVersionMetadata() {
def build_id = System.getenv("GITHUB_RUN_NUMBER")
def workflow_id = System.getenv("GITHUB_WORKFLOW")
// CI builds only
if (workflow_id == "build-release") {
return "+${project.minecraft_version}"
} else if (build_id != null) {
return "+build.${build_id}"
}
if (grgit != null) {
def head = grgit.head()
def id = head.abbreviatedId
// Flag the build if the build tree is not clean
if (!grgit.status().clean) {
id += "-dirty"
}
return "+rev.${id}"
}
}