69 lines
1.9 KiB
Groovy
69 lines
1.9 KiB
Groovy
def version=""
|
|
|
|
pipeline {
|
|
agent any
|
|
options {
|
|
timestamps()
|
|
ansiColor("xterm")
|
|
disableConcurrentBuilds()
|
|
}
|
|
stages {
|
|
stage('version') {
|
|
steps {
|
|
//sh 'env'
|
|
sh 'git fetch --tags'
|
|
script {
|
|
version = sh(
|
|
script: 'git describe --tags --abbrev=0',
|
|
returnStdout: true
|
|
).trim()
|
|
echo "version: ${version}"
|
|
}
|
|
|
|
}
|
|
}
|
|
stage('compile') {
|
|
steps {
|
|
sh 'scp dht.c pibuilder.sudo.is:/srv/jenkins/dht.c'
|
|
sh 'ssh pibuilder.sudo.is "mkdir -p dist/bin"'
|
|
sh 'ssh pibuilder.sudo.is "/usr/bin/cc -Wall dht.c -o dist/bin/dht -lwiringPi"'
|
|
}
|
|
}
|
|
stage('deb file') {
|
|
steps {
|
|
sh "./package.sh ${version}"
|
|
}
|
|
}
|
|
}
|
|
post {
|
|
success {
|
|
archiveArtifacts(
|
|
artifacts: 'dist/*.deb,dist/*.tar.gz',
|
|
fingerprint: true
|
|
)
|
|
|
|
sh "cp dist/*.deb ${env.JENKINS_HOME}/artifacts"
|
|
sh "cp dist/*.tar.gz ${env.JENKINS_HOME}/artifacts"
|
|
|
|
script {
|
|
build(
|
|
job: "/utils/apt",
|
|
wait: false,
|
|
parameters: [[
|
|
$class: 'StringParameterValue',
|
|
name: 'filename',
|
|
value: "sudoisdht_${version}_armhf.deb"
|
|
]]
|
|
)
|
|
}
|
|
}
|
|
cleanup {
|
|
sh 'ssh pibuilder.sudo.is "rm /srv/jenkins/dht.c"'
|
|
sh 'ssh pibuilder.sudo.is "rm -rf /srv/jenkins/dist"'
|
|
// cleanWs()
|
|
sh 'rm dist/*.deb || true'
|
|
sh 'rm dist/*.tar.gz || true'
|
|
}
|
|
}
|
|
}
|