Attempting to get changelogs working

This commit is contained in:
Adubbz 2015-02-16 11:45:49 +11:00
parent ca411eaaf0
commit 1104dacdad

View file

@ -118,7 +118,28 @@ task createChangelog(type: ChangelogTask) {
setAuthName(new DelayedString(project, 'console_script')); setAuthName(new DelayedString(project, 'console_script'));
setAuthPassword(new DelayedString(project, 'dc6d48ca20a474beeac280a9a16a926e')); setAuthPassword(new DelayedString(project, 'dc6d48ca20a474beeac280a9a16a926e'));
setTargetBuild({buildNumber.toString()}); setTargetBuild({buildNumber.toString()});
setOutput(new DelayedFile(project, 'build/distributions/' + project.getName() + '-' + project.version + '-changelog.txt')); setOutput(new DelayedFile(project, 'build/libs/' + project.getName() + '-' + project.version + '-changelog.txt'));
}
task createCurseChangelog {
def env = System.getenv()
def jenkinsUrl = env.JENKINS_URL
def jenkinsJob = env.JOB_NAME
def buildNumber = env.BUILD_NUMBER
if (jenkinsUrl != null && jenkinsJob != null && buildNumber != null) {
def url = new URL("$jenkinsUrl/job/$jenkinsJob/$buildNumber/api/xml?depth=20").openConnection()
String data = url.getInputStream().text
def changelog = ""
def xml = new XmlSlurper().parseText(data)
xml.changeSet.item.each { change ->
changelog += "$change.author.fullName: $change.msg" + '\n'
}
project.changelog = changelog
}
} }
tasks.build.dependsOn('createChangelog') tasks.build.dependsOn('createChangelog')
@ -147,8 +168,11 @@ artifacts {
} }
curse { curse {
dependsOn "createCurseChangelog"
projectId = project.config.curse_project_id projectId = project.config.curse_project_id
apiKey = "$System.env.curse_api_key" apiKey = "$System.env.curse_api_key"
changelog = project.changelog
releaseType = project.config.curse_release_type releaseType = project.config.curse_release_type
additionalArtifact deobfJar additionalArtifact deobfJar