Create deployDebug and deployRelease tasks that automatically depend on relevant steps

This commit is contained in:
Johannes Frohnmeyer 2022-03-13 15:32:22 +00:00
parent 28a8d15398
commit be3db8824d
2 changed files with 22 additions and 9 deletions

View File

@ -309,6 +309,19 @@ dependencies {
}
}
def readmeFile = rootProject.file("README.md")
task deployDebug() {
}
task deployRelease() {
}
tasks.publish.dependsOn(tasks.build)
tasks.deployDebug.dependsOn(tasks.publish)
tasks.deployRelease.dependsOn(tasks.deployDebug)
if (ext.modrinthAvailable) {
modrinth {
token = System.getenv().MODRINTH_API_TOKEN
@ -329,10 +342,13 @@ if (ext.modrinthAvailable) {
String dep -> dependencies.add(new com.modrinth.minotaur.dependencies.ModDependency(dep, "optional"))
}
}
if (readmeFile.exists()) {
syncBodyFrom = readmeFile.text
}
}
}
else {
task modrinth() {
tasks.deployRelease.dependsOn(tasks.modrinth)
if (readmeFile.exists()) {
tasks.deployRelease.dependsOn(tasks.modrinthSyncBody)
}
}
@ -374,8 +390,5 @@ if (ext.curseforgeAvailable) {
forgeGradleIntegration = false
}
}
}
else {
task curseforge() {
}
tasks.deployRelease.dependsOn(tasks.curseforge)
}

View File

@ -13,7 +13,7 @@ stages:
build_test:
stage: build
script:
- gradle --build-cache build publish -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- gradle --build-cache deployDebug -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- cp build/libs/* ./
- cp build/devlibs/*-dev.jar ./
- rm *-maven.jar *-sources.jar
@ -31,4 +31,4 @@ deploy:
- if: $CI_COMMIT_TAG && '$CI_MERGE_REQUEST_SOURCE_BRANCH_NAME =~ /^master/'
stage: deploy
script:
- gradle --build-cache build publish curseforge modrinth -Prelease -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"
- gradle --build-cache deployRelease -Prelease -Pmaven="$CI_API_V4_URL/projects/$CI_PROJECT_ID/packages/maven"