Skip to content

generate-podcast

generate-podcast #393

name: generate-podcast
on:
workflow_dispatch:
inputs:
debug:
description: 'Run in debug mode'
required: false
default: 'false'
type: boolean
voice_service:
description: 'Voice service to use'
required: false
default: 'openai'
type: choice
options:
- openai
- elevenlabs
schedule:
- cron: '30 10 * * *' # 6:30am EST daily
permissions:
contents: read
actions: write # for caching
env:
NODE_VERSION: 23.6.0
PNPM_VERSION: 9.15.4
COVERED_STORIES_CACHE_KEY: ${{ github.ref }}-covered-stories
jobs:
podcast:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
# https://github.com/actions/virtual-environments/issues/1187
- name: tune linux network
run: sudo ethtool -K eth0 tx off rx off
- name: Setup FFmpeg
# Forked this PR: https://github.com/federicocarboni/setup-ffmpeg/pull/23
uses: denolfe/setup-ffmpeg@retries
- name: Node setup
uses: ./.github/actions/setup
with:
node-version: ${{ env.NODE_VERSION }}
pnpm-version: ${{ env.PNPM_VERSION }}
pnpm-install-cache-key: pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
- name: Create cache directory
run: mkdir ./cache
# Restore cache from cache/covered-stories
- name: Restore covered-stories
id: cache-restore
uses: actions/cache/restore@v4
with:
path: ./cache/covered-stories
key: ${{ env.COVERED_STORIES_CACHE_KEY }}
- name: Generate podcast
run: pnpm start
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
ELEVEN_LABS_API_KEY: ${{ secrets.ELEVEN_LABS_API_KEY }}
DEBUG: ${{ github.event.inputs.debug }}
# Use `elevenlabs` on main, else `openai`
VOICE_SERVICE: ${{ github.event.inputs.voice_service || (github.ref == 'refs/heads/main' && 'elevenlabs' || 'openai') }}
TRANSISTOR_API_KEY: ${{ secrets.TRANSISTOR_API_KEY }}
- uses: actions/upload-artifact@v4
if: always()
with:
name: output-and-cache
path: |
output
cache
retention-days: 7
- name: Delete Previous Cache
if: ${{ steps.cache-restore.outputs.cache-hit }}
continue-on-error: true
run: |
gh extension install actions/gh-actions-cache
gh actions-cache delete "${{ env.COVERED_STORIES_CACHE_KEY }}" --confirm
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Cache cache/covered-stories for next run
- name: Cache covered-stories
uses: actions/cache/save@v4
with:
path: ./cache/covered-stories
key: ${{ env.COVERED_STORIES_CACHE_KEY }}
- name: Log covered-stories, show-notes, transcript
run: |
set -ex
cat cache/covered-stories
cat output/*.txt