Skip to content

generate-podcast

generate-podcast #12

name: generate-podcast
on:
workflow_dispatch:
inputs:
debug:
description: 'Run in debug mode'
required: false
default: 'false'
type: boolean
# every morning at 4am EST
schedule:
- cron: '0 9 * * *' # 4am EST
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
- name: Install ffmpeg
run: sudo apt-get update && sudo apt-get install -y ffmpeg
- 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 }}
- run: pnpm start
env:
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
DEBUG: ${{ github.event.inputs.debug }}
# Use `elevenlabs` on main, else `openai`
VOICE_SERVICE: ${{ github.ref == 'refs/heads/main' && 'elevenlabs' || 'openai' }}
- 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 }}
- uses: actions/upload-artifact@v4
with:
name: output
path: output
retention-days: 1
- uses: actions/upload-artifact@v4
with:
name: covered-stories
path: ./cache/covered-stories
retention-days: 7