Added RSS
This commit is contained in:
53
jenkins/324JenkinsfileRSS
Normal file
53
jenkins/324JenkinsfileRSS
Normal file
@@ -0,0 +1,53 @@
|
|||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
triggers {
|
||||||
|
// 'H' balances the load on Jenkins, running roughly every 30 minutes
|
||||||
|
cron('H/30 * * * *')
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Checkout Code') {
|
||||||
|
steps {
|
||||||
|
checkout scm
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Setup Python & Install Dependencies') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
# Create a virtual environment named 'venv'
|
||||||
|
python3 -m venv venv
|
||||||
|
|
||||||
|
# Activate it and install the required packages
|
||||||
|
. venv/bin/activate
|
||||||
|
pip install -U atproto fastfeedparser beautifulsoup4 httpx arrow charset-normalizer
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Run Script') {
|
||||||
|
steps {
|
||||||
|
// Securely inject Jenkins credentials as environment variables
|
||||||
|
withCredentials([
|
||||||
|
string(credentialsId: 'BSKY_324_HANDLE', variable: 'BSKY_324_HANDLE'),
|
||||||
|
string(credentialsId: 'BSKY_324_USERNAME', variable: 'BSKY_324_USERNAME'),
|
||||||
|
string(credentialsId: 'BSKY_324_APP_PASSWORD', variable: 'BSKY_324_APP_PASSWORD')
|
||||||
|
]) {
|
||||||
|
sh '''
|
||||||
|
# Activate the exact same virtual environment so Python finds the packages
|
||||||
|
. venv/bin/activate
|
||||||
|
|
||||||
|
# Run the script with the RSS URL, credentials, and custom service flag
|
||||||
|
python3 rss2bsky.py \
|
||||||
|
"https://api.3cat.cat/noticies?_format=rss&origen=frontal&frontal=n324-portada-noticia&version=2.0" \
|
||||||
|
"$BSKY_324_HANDLE" \
|
||||||
|
"$BSKY_324_USERNAME" \
|
||||||
|
"$BSKY_324_APP_PASSWORD" \
|
||||||
|
--service "https://eurosky.social"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,23 +1,53 @@
|
|||||||
name: 3CatInfo RSS to BSKY
|
pipeline {
|
||||||
description: "A GitHub Action to post 324 (now 3CatInfo) RSS feed items to Bluesky (BSKY) using a Python script."
|
agent any
|
||||||
|
|
||||||
on:
|
triggers {
|
||||||
workflow_dispatch:
|
// 'H' balances the load on Jenkins, running roughly every 30 minutes
|
||||||
schedule:
|
cron('H/30 * * * *')
|
||||||
- cron: '*/30 * * * *' # every 30 minutes
|
}
|
||||||
|
|
||||||
jobs:
|
stages {
|
||||||
post:
|
stage('Checkout Code') {
|
||||||
runs-on: ubuntu-latest
|
steps {
|
||||||
steps:
|
checkout scm
|
||||||
- uses: actions/checkout@v4
|
}
|
||||||
- name: Set up Python
|
}
|
||||||
uses: actions/setup-python@v5
|
|
||||||
with:
|
stage('Setup Python & Install Dependencies') {
|
||||||
python-version: '3.14'
|
steps {
|
||||||
- name: Install dependencies
|
sh '''
|
||||||
run: |
|
# Create a virtual environment named 'venv'
|
||||||
pip install atproto fastfeedparser beautifulsoup4 httpx arrow charset-normalizer
|
python3 -m venv venv
|
||||||
- name: Run script
|
|
||||||
run: |
|
# Activate it and install the required packages
|
||||||
python3 rss2bsky.py https://api.3cat.cat/noticies\?_format\=rss\&origen\=frontal\&frontal\=n324-portada-noticia\&version\=2.0 ${{ secrets.BSKY_324_HANDLE }} ${{ secrets.BSKY_324_USERNAME }} ${{ secrets.BSKY_324_APP_PASSWORD }} --service "https://eurosky.social"
|
. venv/bin/activate
|
||||||
|
pip install -U atproto fastfeedparser beautifulsoup4 httpx arrow charset-normalizer
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
stage('Run Script') {
|
||||||
|
steps {
|
||||||
|
// Securely inject Jenkins credentials as environment variables
|
||||||
|
withCredentials([
|
||||||
|
string(credentialsId: 'BSKY_324_HANDLE', variable: 'BSKY_324_HANDLE'),
|
||||||
|
string(credentialsId: 'BSKY_324_USERNAME', variable: 'BSKY_324_USERNAME'),
|
||||||
|
string(credentialsId: 'BSKY_324_APP_PASSWORD', variable: 'BSKY_324_APP_PASSWORD')
|
||||||
|
]) {
|
||||||
|
sh '''
|
||||||
|
# Activate the exact same virtual environment so Python finds the packages
|
||||||
|
. venv/bin/activate
|
||||||
|
|
||||||
|
# Run the script with the RSS URL, credentials, and custom service flag
|
||||||
|
python3 rss2bsky.py \
|
||||||
|
"https://api.3cat.cat/noticies?_format=rss&origen=frontal&frontal=n324-portada-noticia&version=2.0" \
|
||||||
|
"$BSKY_324_HANDLE" \
|
||||||
|
"$BSKY_324_USERNAME" \
|
||||||
|
"$BSKY_324_APP_PASSWORD" \
|
||||||
|
--service "https://eurosky.social"
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user