diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 2c68ab32..1ac73cd0 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -11,6 +11,7 @@ pool: variables: GRADLE_USER_HOME: $(Pipeline.Workspace)/.gradle + BUILD_NUMBER: $(BuildID) steps: - task: Cache@2 @@ -29,4 +30,4 @@ steps: jdkArchitectureOption: 'x64' publishJUnitResults: true testResultsFiles: '**/TEST-*.xml' - tasks: 'build' + tasks: 'clean build publish' diff --git a/build.gradle b/build.gradle index d3603885..ca05cfc8 100644 --- a/build.gradle +++ b/build.gradle @@ -17,6 +17,9 @@ version = '20.1' group = 'de.ellpeck.naturesaura' // http://maven.apache.org/guides/mini/guide-naming-conventions.html archivesBaseName = 'NaturesAura' +if (System.getenv('BUILD_NUMBER') != null) { + version += "." + System.getenv('BUILD_NUMBER') +} sourceCompatibility = targetCompatibility = compileJava.sourceCompatibility = compileJava.targetCompatibility = '1.8' // Need this here so eclipse task generates correctly. minecraft { @@ -102,8 +105,6 @@ dependencies { runtimeOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2") compileOnly fg.deobf("top.theillusivec4.curios:curios:FORGE-1.15.2-2.0-beta2:api") - - compile fileTree(dir: 'lib', include: '*.jar') } // Example for how to get properties into the manifest for reading by the runtime.. @@ -121,24 +122,35 @@ jar { } } -// Example configuration to allow publishing using the maven-publish task -// we define a custom artifact that is sourced from the reobfJar output task -// and then declare that to be published -// Note you'll need to add a repository here -def reobfFile = file("$buildDir/reobfJar/output.jar") -def reobfArtifact = artifacts.add('default', reobfFile) { - type 'jar' - builtBy 'reobfJar' +task deobfJar(type: Jar) { + from(sourceSets.main.output) + archiveName = "${baseName}-${version}-deobf.${extension}" } +artifacts { + archives deobfJar +} + publishing { publications { mavenJava(MavenPublication) { - artifact reobfArtifact + groupId project.group + artifactId project.archivesBaseName + version project.version + from components.java + + artifact deobfJar { + classifier 'deobf' + } + artifact 'build/libs/**.jar' } } repositories { maven { - url "file:///${project.projectDir}/mcmodsrepo" + url 'https://pkgs.dev.azure.com/Ellpeck/_packaging/NaturesAura' + credentials { + username "Azure DevOps Services" + password System.getenv("Azure DevOps Services_ENV_ACCESS_TOKEN") + } } } } \ No newline at end of file