58 lines
1.8 KiB
Plaintext
58 lines
1.8 KiB
Plaintext
pipeline {
|
|
agent any
|
|
|
|
triggers {
|
|
// Every Friday at 07:15
|
|
cron('15 7 * * 5')
|
|
}
|
|
|
|
options {
|
|
timeout(time: 15, unit: 'MINUTES')
|
|
timestamps()
|
|
buildDiscarder(logRotator(numToKeepStr: '10'))
|
|
disableConcurrentBuilds()
|
|
}
|
|
|
|
stages {
|
|
stage('Install dependencies') {
|
|
steps {
|
|
sh """
|
|
python3 -m venv venv
|
|
. venv/bin/activate
|
|
pip install --upgrade pip --quiet
|
|
pip install --quiet atproto requests
|
|
"""
|
|
}
|
|
}
|
|
|
|
stage('Post Divendres') {
|
|
steps {
|
|
// Securely injects Jenkins credentials as environment variables
|
|
// Note the added curly braces wrapping the sh block
|
|
withCredentials([
|
|
string(credentialsId: 'BSKY_GROMENAWARE_HANDLE', variable: 'BSKY_GROMENAWARE_HANDLE'),
|
|
string(credentialsId: 'BSKY_GROMENAWARE_APP_PASSWORD', variable: 'BSKY_GROMENAWARE_APP_PASSWORD')
|
|
]) {
|
|
sh """
|
|
. venv/bin/activate
|
|
python3 bsky_post.py "Feliç dijous!!!!" \\
|
|
--username "\$BSKY_HANDLE" \\
|
|
--password "\$BSKY_APP_PASSWORD" \\
|
|
--image media/dijous.jpg \\
|
|
--alt "Feliç dijous!!" \\
|
|
--lang ca \\
|
|
--service https://eurosky.social
|
|
"""
|
|
}
|
|
}
|
|
}
|
|
|
|
post {
|
|
success {
|
|
echo '✅ Dijous post published successfully.'
|
|
}
|
|
failure {
|
|
echo '❌ Dijous post failed.'
|
|
}
|
|
}
|
|
} |