piwigodotnet/Jenkinsfile
Philipp Häfelfinger 4684829f81
All checks were successful
piwigodotnet/pipeline/head This commit looks good
updates jenkins to publish nuget to gitea
2022-11-03 15:17:33 +01:00

57 lines
1.5 KiB
Groovy

pipeline {
agent {
docker { image 'mcr.microsoft.com/dotnet/sdk:6.0'}
}
environment {
PWDNVERSION = "0.1.0"
// home is required to make dotnet work as if undived / is used which is not accessible
HOME = "${env.WORKSPACE}"
}
stages {
stage('preparing workspace') {
steps {
cleanWs deleteDirs: true, notFailBuild: true, patterns: [[pattern: '.nuget/NuGet/NuGet.Config', type: 'INCLUDE']]
dir('publish') {
deleteDir()
}
withCredentials([usernamePassword(credentialsId: 'giteaNugetPushCreds', passwordVariable: 'NUGETPWD', usernameVariable: 'NUGETUSR')]) {
sh 'dotnet nuget add source --name gitea --username $NUGETUSR --password $NUGETPWD --store-password-in-clear-text https://git.haefelfinger.net/api/packages/piwigo/nuget/index.json'
}
}
}
stage('nuget restore') {
steps {
sh "dotnet restore ${env.WORKSPACE}/src/PiwigoDotnet.sln"
}
}
stage('test') {
steps {
sh "dotnet test ${env.WORKSPACE}/src/PiwigoDotnet.sln --no-restore"
}
}
stage('packing') {
steps {
sh "dotnet pack ${env.WORKSPACE}/src/PiwigoDotnet.sln --no-restore -c Release -o ${env.WORKSPACE}/publish -p:Version=${env.PWDNVERSION}.${env.BUILD_NUMBER}"
}
}
stage('nuget publish') {
steps {
sh "dotnet nuget push --source gitea ${env.WORKSPACE}/publish/*.nupkg"
}
}
}
post {
always {
archiveArtifacts artifacts: "publish/*.nupkg", onlyIfSuccessful: true
}
}
}