Skip to content

FreakyBits Daily Pipeline #131

FreakyBits Daily Pipeline

FreakyBits Daily Pipeline #131

name: FreakyBits Daily Pipeline
on:
schedule:
- cron: '30 1 * * *' # 7:00 AM IST
- cron: '30 13 * * *' # 7:00 PM IST
workflow_dispatch:
inputs:
force_niche:
description: 'Force niche'
required: false
default: ''
jobs:
freakyBits-run:
runs-on: ubuntu-latest
timeout-minutes: 60
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Python 3.11
uses: actions/setup-python@v5
with:
python-version: '3.11'
- name: Cache pip
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
- name: Install dependencies
run: pip install -r requirements.txt
- name: Install FFmpeg and fonts
run: |
sudo apt-get update -qq
sudo apt-get install -y ffmpeg fonts-liberation fonts-open-sans
ffmpeg -version | head -1
- name: Create output directory
run: mkdir -p buzzBits_output
- name: Write YouTube client secrets
run: echo '${{ secrets.YOUTUBE_CLIENT_SECRETS }}' > youtube_secrets.json
- name: Restore YouTube OAuth token
run: |
if [ -n "${{ secrets.YOUTUBE_TOKEN_B64 }}" ]; then
echo '${{ secrets.YOUTUBE_TOKEN_B64 }}' | base64 -d > buzzBits_output/yt_token.pickle
echo "YouTube token restored"
fi
- name: Restore Part 1 topic
run: |
if [ -n "${{ secrets.PART1_TOPIC_JSON }}" ]; then
echo '${{ secrets.PART1_TOPIC_JSON }}' > buzzBits_output/part1_topic.json
fi
- name: Run FreakyBits Pipeline
env:
GEMINI_API_KEY: ${{ secrets.GEMINI_API_KEY }}
PEXELS_API_KEY: ${{ secrets.PEXELS_API_KEY }}
INSTAGRAM_TOKEN: ${{ secrets.INSTAGRAM_TOKEN }}
INSTAGRAM_ACCOUNT_ID: ${{ secrets.INSTAGRAM_ACCOUNT_ID }}
FORCE_NICHE: ${{ github.event.inputs.force_niche }}
run: python pipeline.py
- name: Save Part 1 topic
if: always()
run: |
if [ -f buzzBits_output/part1_topic.json ]; then
echo "Part1 topic saved - update PART1_TOPIC_JSON secret"
cat buzzBits_output/part1_topic.json
fi
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: freakyBits-run-${{ github.run_number }}
path: |
buzzBits_output/*.mp4
buzzBits_output/*.json
retention-days: 7