Build podcast #2918
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: Build podcast | |
on: | |
schedule: | |
- cron: '8 13-23,0-3 * * 1-5' | |
push: | |
branches: | |
- master | |
jobs: | |
build_podcast: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: ./ | |
steps: | |
- name: Set up Git repository | |
uses: actions/checkout@v4 | |
- name: Install apt packages (sox, libsox-fmt-mp3) | |
uses: awalsh128/cache-apt-pkgs-action@latest | |
with: | |
packages: sox libsox-fmt-mp3 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.11' | |
architecture: 'x64' | |
cache: 'pip' | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20' | |
cache: 'npm' | |
- name: Install pip and npm dependencies | |
run: | | |
pip install -r requirements.txt | |
npm install | |
- name: Run script | |
env: | |
B2_APP_KEY: ${{ secrets.B2_APP_KEY }} | |
B2_APP_KEY_ID: ${{ secrets.B2_APP_KEY_ID }} | |
FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }} | |
SMTP_PASSWORD: ${{ secrets.SMTP_PASSWORD }} | |
run: | | |
touch commit_message.txt | |
python3 podcast.py | |
- name: Commit and push if there are changes | |
run: | | |
COMMIT_MESSAGE_FILE="commit_message.txt" | |
if [[ -s "$COMMIT_MESSAGE_FILE" ]]; then | |
# If not empty, get content and commit | |
COMMIT_MESSAGE=$(<"$COMMIT_MESSAGE_FILE") | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
git add data/case_data.json | |
git add data/podcast.rss | |
git add data/podcast_spotify.rss | |
git commit -m "$COMMIT_MESSAGE" | |
git push | |
fi |