Generate Podcast Data #204
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: Generate Podcast Data | |
on: | |
push: | |
branches: | |
- main | |
# Run on cron - every week | |
schedule: | |
- cron: "0 0 * * 0" | |
permissions: write-all | |
jobs: | |
generate-podcast-data: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Cache node modules | |
uses: actions/cache@v2 | |
env: | |
cache-name: node-cache | |
with: | |
# npm cache files are stored in `~/.npm` on Linux/macOS | |
path: ~/.npm | |
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-build-${{ env.cache-name }}- | |
${{ runner.os }}-build- | |
${{ runner.os }}- | |
- uses: actions/cache@v2 | |
env: | |
cache-name: python-cache | |
if: startsWith(runner.os, 'Linux') | |
with: | |
path: ~/.cache/pip | |
key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} | |
restore-keys: | | |
${{ runner.os }}-pip- | |
- name: 'Install npm dependencies 🪨' | |
if: steps.node-cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: 'Install python deps 🐍' | |
if: steps.python-cache.outputs.cache-hit != 'true' | |
run: pip3 install -r requirements.txt | |
- name: 'compile 🏗️' | |
run: npx tsc | |
- name: 'Prepare 🧑🍳' | |
run: | | |
mkdir dist | |
touch dist/rssUrls.txt | |
mkdir tmp | |
mkdir tmp/dist | |
touch tmp/dist/logs.md | |
mkdir tmp/dist/podcasts | |
mkdir tmp/dist/podcasts_palettes | |
mkdir tmp/dist/.github | |
mkdir tmp/dist/.github/workflows | |
- name: 'Generate Files 🤖' | |
run: node --max-old-space-size=8192 out/index.js | |
- name: 'Generate Palette 🎨' | |
run: | | |
python3 scripts/generate.py | |
cp -r tmp/dist/podcasts_palettes dist/podcasts_palettes | |
cp LICENSE.txt dist/LICENSE.txt | |
cp docs/dataReadMe.md dist/ReadMe.md | |
mkdir dist/.github | |
mkdir dist/.github/workflows | |
cp scripts/templates/release.yml dist/.github/workflows/release.yml | |
- name: Verify Changed files 🐒 | |
uses: tj-actions/[email protected] | |
id: verify-changed-files | |
with: | |
files: | | |
dist | |
- name: 'Deploy 💾' | |
if: steps.verify-changed-files.outputs.files_changed == 'true' | |
uses: s0/git-publish-subdir-action@develop | |
env: | |
REPO: self | |
BRANCH: release | |
FOLDER: dist | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |