aggregate-audio #3680
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: aggregate-audio | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */2 * * *' | |
jobs: | |
download-audio: | |
if: (github.event_name == 'schedule' && github.repository == 'Adventech/sabbath-school-lessons') || (github.event_name != 'schedule') | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup yt-dlp | |
uses: AnimMouse/setup-yt-dlp@v1 | |
with: | |
with-ffmpeg: true | |
- uses: actions/checkout@v2 | |
- uses: actions/setup-node@v2 | |
with: | |
node-version: '12' | |
check-latest: 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/push@v1.3 | |
with: | |
branch: 'stage' | |
github_token: ${{ secrets.PERSONAL_GH_TOKEN }} |