mirror of
				https://github.com/InsanusMokrassar/KSLog.git
				synced 2025-11-03 21:10:13 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			39 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
			
		
		
	
	
			39 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			Groovy
		
	
	
	
	
	
private String getCurrentVersionChangelog() {
 | 
						|
    OutputStream changelogDataOS = new ByteArrayOutputStream()
 | 
						|
    exec {
 | 
						|
        commandLine 'chmod', "+x", './changelog_parser.sh'
 | 
						|
    }
 | 
						|
    exec {
 | 
						|
        standardOutput = changelogDataOS
 | 
						|
        commandLine './changelog_parser.sh', "${project.version}", 'CHANGELOG.md'
 | 
						|
    }
 | 
						|
 | 
						|
    return changelogDataOS.toString().trim()
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
def githubTokenVariableName = "GITHUB_RELEASE_TOKEN"
 | 
						|
def githubTokenVariableFromEnv = System.getenv(githubTokenVariableName)
 | 
						|
 | 
						|
def secretFile = new File(projectDir, "secret.gradle")
 | 
						|
if (secretFile.exists() || project.hasProperty(githubTokenVariableName) || (githubTokenVariableFromEnv != "" && githubTokenVariableFromEnv != null)) {
 | 
						|
    if (secretFile.exists()) {
 | 
						|
        apply from: './secret.gradle'
 | 
						|
    }
 | 
						|
    apply plugin: "com.github.breadmoirai.github-release"
 | 
						|
    def githubReleaseToken = project.hasProperty(githubTokenVariableName) ? project.property(githubTokenVariableName).toString() : githubTokenVariableFromEnv
 | 
						|
 | 
						|
    githubRelease {
 | 
						|
        token githubReleaseToken
 | 
						|
 | 
						|
        owner = "InsanusMokrassar"
 | 
						|
        repo = "KSLog"
 | 
						|
 | 
						|
        tagName = "v${project.version}"
 | 
						|
        releaseName = "${project.version}"
 | 
						|
        targetCommitish = "${project.version}"
 | 
						|
 | 
						|
        body = getCurrentVersionChangelog()
 | 
						|
    }
 | 
						|
}
 |