PiwigoDirectorySync/Jenkinsfile

56 lines
1.7 KiB
Plaintext
Raw Permalink Normal View History

2023-08-29 22:37:24 +02:00
pipeline {
agent {
2023-08-30 23:47:02 +02:00
docker { image 'mcr.microsoft.com/dotnet/sdk:7.0'}
2023-08-29 22:37:24 +02:00
}
environment {
APPVERSION = "0.0.1"
HOME = "${env.WORKSPACE}"
}
stages {
stage('preparing workspace') {
steps {
2023-08-30 23:59:36 +02:00
cleanWs deleteDirs: true, notFailBuild: true, patterns: [[pattern: '.nuget/NuGet/NuGet.Config', type: 'INCLUDE'],[pattern: 'NuGet.Config', type: 'INCLUDE']]
2023-08-29 22:37:24 +02:00
dir('publish') {
deleteDir()
}
withCredentials([usernamePassword(credentialsId: 'giteaNugetPushCreds', passwordVariable: 'NUGETPWD', usernameVariable: 'NUGETUSR')]) {
2023-08-30 23:59:36 +02:00
sh 'dotnet nuget add source --name piwigo.git.haefelfinger.net --username $NUGETUSR --password $NUGETPWD --store-password-in-clear-text https://git.haefelfinger.net/api/packages/piwigo/nuget/index.json'
2023-08-29 22:37:24 +02:00
}
}
}
stage('nuget restore') {
steps {
2023-08-30 23:47:02 +02:00
sh "dotnet restore ${env.WORKSPACE}/PiwigoDirectorySync.sln"
2023-08-29 22:37:24 +02:00
}
}
stage('test') {
steps {
2023-08-30 23:47:02 +02:00
sh "dotnet test ${env.WORKSPACE}/PiwigoDirectorySync.sln --no-restore"
2023-08-29 22:37:24 +02:00
}
}
2023-08-30 23:47:02 +02:00
stage('build linux binary') {
2023-08-29 22:37:24 +02:00
steps {
2023-08-31 23:28:44 +02:00
sh "dotnet publish ${env.WORKSPACE}/PiwigoDirectorySync/PiwigoDirectorySync.csproj -c Release --self-contained true -r linux-x64 -o ${env.WORKSPACE}/publish/linux -p:Version=${env.APPVERSION}.${env.BUILD_NUMBER}"
2023-08-29 22:37:24 +02:00
}
}
2023-08-30 23:47:02 +02:00
stage('build windows binary') {
2023-08-29 22:37:24 +02:00
steps {
2023-08-31 23:28:44 +02:00
sh "dotnet publish ${env.WORKSPACE}/PiwigoDirectorySync/PiwigoDirectorySync.csproj -c Release --self-contained true -r win-x64 -o ${env.WORKSPACE}/publish/windows -p:Version=${env.APPVERSION}.${env.BUILD_NUMBER}"
2023-08-29 22:37:24 +02:00
}
}
}
post {
always {
archiveArtifacts artifacts: "publish/**/*", onlyIfSuccessful: true
}
}
}