Skip to content

aggregate-audio

aggregate-audio #3966

name: aggregate-audio
on:
workflow_dispatch:
schedule:
- cron: '0 */2 * * *'
push:
branches:
- stage
paths:
- 'aggregate-audio.yml'
jobs:
download-audio:
if: (github.event_name == 'schedule' && github.repository == 'Adventech/sabbath-school-lessons') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: '12'
check-latest: true
- name: Setup yt-dlp
uses: AnimMouse/[email protected]
with:
with-ffmpeg: true
- name: Add token for private packages
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGES_SECRET }}" >> .npmrc
- run: npm install
- name: Create work dir folder
run: mkdir ss-audio
- name: Run download audio script
run: node runners/content-downloader/download-audio.js
env:
GITHUB_TOKEN: ${{ secrets.PERSONAL_GH_TOKEN }}
- name: Download audio
shell: bash
working-directory: ss-audio
run: cat audio-commands.txt && bash audio-commands.txt
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_EC2_METADATA_DISABLED: true
- name: Clean the audio commands
run: rm audio-commands.txt
working-directory: ss-audio
- name: Upload
working-directory: ss-audio
run: aws s3 cp . s3://sabbath-school-media-tmp --region us-east-1 --acl "public-read" --recursive
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aggregate-audio:
if: (github.event_name == 'schedule' && github.repository == 'Adventech/sabbath-school-lessons') || (github.event_name != 'schedule')
runs-on: ubuntu-latest
needs: download-audio
steps:
- uses: actions/checkout@v2
with:
ref: stage
fetch-depth: 0
persist-credentials: false
github_token: ${{ secrets.PERSONAL_GH_TOKEN }}
- uses: actions/setup-node@v2
with:
node-version: '16'
check-latest: true
- name: Add token for private packages
run: echo "//npm.pkg.github.com/:_authToken=${{ secrets.PACKAGES_SECRET }}" >> .npmrc
- run: npm install
- name: Aggregate audio
run: node ./runners/content-aggregator/index.js
- run: rm package-lock.json
- name: Reset .npmrc
run: git restore .npmrc
- name: Commit & Push changes
uses: actions-js/[email protected]
with:
branch: 'stage'
github_token: ${{ secrets.PERSONAL_GH_TOKEN }}