cazette/Jenkinsfile

58 lines
1.3 KiB
Plaintext
Raw Normal View History

2025-01-17 11:28:15 +01:00
@Library("cadoles") _
pipeline {
agent {
dockerfile {
label 'docker'
filename 'Dockerfile'
dir 'misc/ci'
}
}
triggers {
cron('0 9 * * 1')
}
stages {
stage("Send newsletter") {
when {
anyOf {
triggeredBy 'TimerTrigger'
}
}
steps {
script {
2025-02-02 19:24:33 +01:00
withCredentials([string(credentialsId: 'NEWS_API_KEY', variable: 'NEWS_API_KEY')]) {
String newsletter = sh(script: "bash ./generate-newsletter.sh", returnStdout: true)
if (newsletter) {
rocketSend(
channel: '#TechWatch',
message: newsletter,
rawMessage: true
)
}
2025-01-17 11:28:15 +01:00
}
}
}
}
stage("Send test newsletter to wpetit") {
when {
branch 'master'
}
steps {
script {
2025-02-02 19:24:33 +01:00
withCredentials([string(credentialsId: 'NEWS_API_KEY', variable: 'NEWS_API_KEY')]) {
String newsletter = sh(script: "bash ./generate-newsletter.sh", returnStdout: true)
if (newsletter) {
rocketSend(
channel: '@wpetit',
message: newsletter,
rawMessage: true
)
}
2025-01-17 11:28:15 +01:00
}
}
}
}
}
}