Update Jenkinsfile #3
This commit is contained in:
parent
7d3afa3f4b
commit
626221cd41
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@ -29,24 +29,26 @@ pipeline {
|
|||||||
script {
|
script {
|
||||||
def repoOwner = 'reza'
|
def repoOwner = 'reza'
|
||||||
def repoName = 'go-hello-world'
|
def repoName = 'go-hello-world'
|
||||||
def tagName = 'v1.0.0'
|
def tagName = 'v1.0.1'
|
||||||
def releaseTitle = 'v1.0.0'
|
def releaseTitle = 'v1.0.1'
|
||||||
def releaseDescription = 'v1.0.0'
|
def releaseDescription = 'v1.0.1'
|
||||||
def zipFile = 'hello-world.zip'
|
def zipFile = 'hello-world.zip'
|
||||||
|
|
||||||
def createReleaseCmd = """
|
def createReleaseResponse = sh(script: """
|
||||||
curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${GITEA_API_TOKEN}" \\
|
curl -s -X POST -H "Content-Type: application/json" -H "Authorization: token ${GITEA_API_TOKEN}" \\
|
||||||
-d '{ "tag_name": "${tagName}", "target_commitish": "main", "name": "${releaseTitle}", "body": "${releaseDescription}", "draft": false, "prerelease": false }' \\
|
-d '{ "tag_name": "${tagName}", "target_commitish": "master", "name": "${releaseTitle}", "body": "${releaseDescription}", "draft": false, "prerelease": false }' \\
|
||||||
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases"
|
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases"
|
||||||
"""
|
""", returnStdout: true).trim()
|
||||||
sh createReleaseCmd
|
|
||||||
|
def parsedResponse = readJSON text: createReleaseResponse
|
||||||
|
def releaseID = parsedResponse.id
|
||||||
|
|
||||||
def uploadAssetCmd = """
|
sh """
|
||||||
curl -X POST -H "Authorization: token ${GITEA_API_TOKEN}" -H "Content-Type: application/zip" \\
|
curl -X POST -H "Authorization: token ${GITEA_API_TOKEN}" -H "Content-Type: application/octet-stream" \\
|
||||||
--data-binary @${zipFile} \\
|
--data-binary @${zipFile} \\
|
||||||
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases/${tagName}/assets?name=${zipFile}"
|
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases/${releaseID}/assets?name=${zipFile}"
|
||||||
"""
|
"""
|
||||||
sh uploadAssetCmd
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user