Added RSS
This commit is contained in:
@@ -1,23 +1,53 @@
|
||||
name: 3CatInfo RSS to BSKY
|
||||
description: "A GitHub Action to post 324 (now 3CatInfo) RSS feed items to Bluesky (BSKY) using a Python script."
|
||||
pipeline {
|
||||
agent any
|
||||
|
||||
triggers {
|
||||
// 'H' balances the load on Jenkins, running roughly every 30 minutes
|
||||
cron('H/30 * * * *')
|
||||
}
|
||||
|
||||
on:
|
||||
workflow_dispatch:
|
||||
schedule:
|
||||
- cron: '*/30 * * * *' # every 30 minutes
|
||||
stages {
|
||||
stage('Checkout Code') {
|
||||
steps {
|
||||
checkout scm
|
||||
}
|
||||
}
|
||||
|
||||
jobs:
|
||||
post:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v5
|
||||
with:
|
||||
python-version: '3.14'
|
||||
- name: Install dependencies
|
||||
run: |
|
||||
pip install atproto fastfeedparser beautifulsoup4 httpx arrow charset-normalizer
|
||||
- name: Run script
|
||||
run: |
|
||||
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"
|
||||
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"
|
||||
'''
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user