Upload Podcast #123
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Upload Podcast | |
on: | |
schedule: | |
- cron: '0 4 * * 2-6' # This runs at 4 AM UTC Tuesday to Saturday, which is 8 PM PST the previous day, Monday to Friday | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: '3.12.0' # Specify the Python version you need | |
- name: Install ffmpeg | |
run: sudo apt-get update && sudo apt-get install -y ffmpeg | |
- name: Read current count | |
id: read_count | |
run: | | |
if [ ! -f count.txt ]; then | |
echo "0" > count.txt | |
fi | |
count=$(cat count.txt) | |
echo "current_count=$count" >> $GITHUB_ENV | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi | |
- name: Upload Podcast [${{ env.current_count }}] | |
env: | |
PODBEAN_CLIENT_ID: ${{ secrets.PODBEAN_CLIENT_ID }} | |
PODBEAN_CLIENT_SECRET: ${{ secrets.PODBEAN_CLIENT_SECRET }} | |
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }} | |
run: | | |
python main.py ${{ env.current_count }} | |
- name: Increment count | |
id: increment | |
run: | | |
new_count=$((current_count + 1)) | |
echo $new_count > count.txt | |
echo "new_count=$new_count" >> $GITHUB_ENV | |
- name: Commit and push new files | |
run: | | |
git config --global user.name "github-actions[bot]" | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git add . | |
git commit -m "Add new files created by upload script" | |
git push | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |