Compare commits
5 Commits
Author | SHA1 | Date | |
---|---|---|---|
1cc91532af | |||
645425ee38 | |||
45ea43f32f | |||
b336e820f9 | |||
626221cd41 |
26
Jenkinsfile
vendored
26
Jenkinsfile
vendored
@ -29,24 +29,26 @@ pipeline {
|
||||
script {
|
||||
def repoOwner = 'reza'
|
||||
def repoName = 'go-hello-world'
|
||||
def tagName = 'v1.0.0'
|
||||
def releaseTitle = 'v1.0.0'
|
||||
def releaseDescription = 'v1.0.0'
|
||||
def tagName = 'v1.0.3'
|
||||
def releaseTitle = 'v1.0.3'
|
||||
def releaseDescription = 'v1.0.3'
|
||||
def zipFile = 'hello-world.zip'
|
||||
|
||||
def createReleaseCmd = """
|
||||
curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${GITEA_API_TOKEN}" \\
|
||||
def createReleaseResponse = sh(script: """
|
||||
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 }' \\
|
||||
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases"
|
||||
"""
|
||||
sh createReleaseCmd
|
||||
""", returnStdout: true).trim()
|
||||
|
||||
def parsedResponse = readJSON text: createReleaseResponse
|
||||
def releaseID = parsedResponse.id
|
||||
|
||||
def uploadAssetCmd = """
|
||||
curl -X POST -H "Authorization: token ${GITEA_API_TOKEN}" -H "Content-Type: application/zip" \\
|
||||
--data-binary @${zipFile} \\
|
||||
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases/${tagName}/assets?name=${zipFile}"
|
||||
sh """
|
||||
curl -X POST -H "Authorization: token ${GITEA_API_TOKEN}" -H "Content-Type: multipart/form-data" \\
|
||||
-F 'attachment=@${zipFile};type=application/zip' \\
|
||||
"https://git.behzadan.ir/api/v1/repos/${repoOwner}/${repoName}/releases/${releaseID}/assets?name=${zipFile}"
|
||||
"""
|
||||
sh uploadAssetCmd
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user