diff options
| -rw-r--r-- | .github/workflows/build.yml | 2 | ||||
| -rw-r--r-- | build.gradle | 15 |
2 files changed, 15 insertions, 2 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7b996401..b92bc8a9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,7 +32,7 @@ jobs: - name: Grant execute permission for gradlew run: chmod +x gradlew - name: Build with Gradle - run: ./gradlew allJar + run: ./gradlew - name: Upload Plugin uses: actions/upload-artifact@master with: diff --git a/build.gradle b/build.gradle index af44415c..a6052dad 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ plugins { id 'maven-publish' } -defaultTasks 'allJar' +defaultTasks 'allJarSnapshot' allprojects { apply plugin: 'java' @@ -15,6 +15,15 @@ allprojects { sourceCompatibility = 1.8 targetCompatibility = 1.8 } + +task versionGit() { + ext.gitCommitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim() + project.version = "${version}-${gitCommitHash}" + subprojects.each { + it.version = "${version}-${gitCommitHash}" + } +} + task allJar( type: Jar, dependsOn: subprojects.tasks['build'] ) { subprojects.each { subproject -> from subproject.configurations.archives.allArtifacts.files.collect { @@ -24,6 +33,10 @@ task allJar( type: Jar, dependsOn: subprojects.tasks['build'] ) { archiveBaseName = 'Quests' } +task allJarSnapshot( dependsOn: [ 'versionGit', 'allJar' ] ) { + allJar.mustRunAfter( 'versionGit' ) +} + artifacts { archives allJar } |
