Files
post2bsky/jenkins/diumenge_nit
2026-05-08 20:12:06 +00:00

60 lines
1.9 KiB
Plaintext

pipeline {
agent any
triggers {
// Every Sunday at 21:15
cron('15 21 * * 0')
}
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 ffmpeg python-dotenv pillow
"""
}
}
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 \
--text "DEMÀ DILLUNS!!!!!!!!!!!!" \
--video media/diumenge.mp4 \
--alt "DEMÀ DILLUNS!!!!!!!!!!!!" \
--bsky-handle "$BSKY_GROMENAWARE_HANDLE" \
--bsky-password "$BSKY_GROMENAWARE_APP_PASSWORD" \
--bsky-base-url "https://eurosky.social" \
--bsky-langs "ca"
"""
}
}
}
}
post {
success {
echo '✅ Dilluns post published successfully.'
}
failure {
echo '❌ Dilluns post failed.'
}
}
}