2024-10-25 21:09:17 -04:00
|
|
|
pipeline {
|
2024-11-09 22:13:10 -05:00
|
|
|
agent any
|
2024-10-25 21:09:17 -04:00
|
|
|
|
|
|
|
stages {
|
2024-11-09 23:53:34 -05:00
|
|
|
stage('nuget pack'){
|
2024-11-09 22:16:12 -05:00
|
|
|
steps{
|
2024-11-09 22:54:36 -05:00
|
|
|
dotnetPack(outputDirectory: "./", project: "nugettest/")
|
2024-11-09 23:53:34 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
stage('build numberify'){
|
|
|
|
steps{
|
2024-11-10 01:54:33 -05:00
|
|
|
//sed -i 's/<Version>\\([0-9]\\+\\.[0-9]\\)\\.[0-9]\\+<\\/Version>/<Version>\\1.$BUILD_NUMBER<\\/Version>/' nugettest/nugettest.csproj
|
2024-11-09 23:46:10 -05:00
|
|
|
sh """
|
|
|
|
filename=\$(ls ./*.nupkg | head -1)
|
|
|
|
fullfilename=\$(basename -- \$filename)
|
2024-11-09 23:30:43 -05:00
|
|
|
noext=\${fullfilename%.*}
|
2024-11-09 23:27:42 -05:00
|
|
|
|
2024-11-09 23:53:34 -05:00
|
|
|
mv "\$filename" \$noext-\$BUILD_NUMBER.nupkg
|
2024-11-09 23:27:42 -05:00
|
|
|
|
2024-11-09 23:53:34 -05:00
|
|
|
filename=null
|
2024-11-09 23:27:42 -05:00
|
|
|
fullfilename=null
|
|
|
|
noext=null
|
|
|
|
"""
|
2024-11-09 23:53:34 -05:00
|
|
|
}
|
|
|
|
}
|
2024-11-10 01:54:33 -05:00
|
|
|
stage('release'){
|
|
|
|
when {
|
|
|
|
branch "release"
|
|
|
|
}
|
2024-11-10 02:00:57 -05:00
|
|
|
environment {
|
|
|
|
GITEA_PAT = credentials('0bd7c8f5-046c-44b9-9c77-7a28a219ae31')
|
|
|
|
}
|
2024-11-09 23:53:34 -05:00
|
|
|
steps{
|
2024-11-10 01:54:33 -05:00
|
|
|
sh """
|
|
|
|
filename=\$(ls ./*.nupkg | head -1)
|
|
|
|
fullfilename=\$(basename -- \$filename)
|
|
|
|
noext=\${fullfilename%.*}
|
|
|
|
curl -X 'POST' \
|
2024-11-10 02:03:59 -05:00
|
|
|
-o release.json \
|
2024-11-10 02:00:57 -05:00
|
|
|
'https://gitea.arg.rip/api/v1/repos/greyn/jenkins-playground/releases?token=$GITEA_PAT' \
|
2024-11-10 01:54:33 -05:00
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H 'Content-Type: application/json' \
|
|
|
|
-d '{
|
2024-11-10 02:14:53 -05:00
|
|
|
"body": "automatic build at \$(date)",
|
2024-11-10 01:54:33 -05:00
|
|
|
"draft": false,
|
|
|
|
"name": "$BUILD_NUMBER",
|
|
|
|
"prerelease": false,
|
|
|
|
"tag_name": "$BUILD_NUMBER",
|
|
|
|
"target_commitish": "$GIT_COMMIT"
|
|
|
|
}'
|
2024-11-10 02:14:53 -05:00
|
|
|
cat release.json
|
2024-11-10 01:54:33 -05:00
|
|
|
releaseid=\$(cat release.json | jq .id)
|
|
|
|
|
2024-11-10 02:10:11 -05:00
|
|
|
postURL="https://gitea.arg.rip/api/v1/repos/greyn/jenkins-playground/releases/\$releaseid/assets?name=\$noext&token=$GITEA_PAT"
|
2024-11-10 01:54:33 -05:00
|
|
|
curl -X 'POST' \
|
2024-11-10 02:07:58 -05:00
|
|
|
\$postURL \
|
2024-11-10 01:54:33 -05:00
|
|
|
-H 'accept: application/json' \
|
|
|
|
-H 'Content-Type: multipart/form-data' \
|
2024-11-10 02:11:36 -05:00
|
|
|
-F "attachment=@\$fullfilename"
|
2024-11-10 01:54:33 -05:00
|
|
|
|
|
|
|
releaseid=null
|
|
|
|
filename=null
|
|
|
|
fullfilename=null
|
|
|
|
noext=null
|
2024-11-10 02:07:58 -05:00
|
|
|
postURL=null
|
2024-11-10 01:54:33 -05:00
|
|
|
"""
|
2024-11-10 00:39:03 -05:00
|
|
|
dotnetNuGetPush(root: "./*.nupkg", source:"greyngitea", skipDuplicate:true)
|
2024-11-09 22:16:12 -05:00
|
|
|
}
|
2024-10-25 21:09:17 -04:00
|
|
|
}
|
2024-11-10 00:49:57 -05:00
|
|
|
}
|
|
|
|
post {
|
|
|
|
always {
|
|
|
|
cleanWs()
|
2024-11-10 00:48:51 -05:00
|
|
|
}
|
2024-10-25 21:09:17 -04:00
|
|
|
}
|
2024-10-30 23:34:45 -04:00
|
|
|
}
|