deploy-video #3492
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: deploy-video | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
- stage | |
paths: | |
- 'deploy-video.js' | |
- 'src/**/video.yml' | |
jobs: | |
deploy-video: | |
if: (github.repository == 'Adventech/sabbath-school-lessons') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Extract branch name | |
shell: bash | |
run: echo "##[set-output name=branch;]$(echo ${GITHUB_REF#refs/heads/})" | |
id: extract_branch | |
- run: gpg --quiet --batch --yes --decrypt --passphrase="$CREDS_PASSPHRASE" --output deploy-creds.tar deploy-creds.tar.gpg | |
env: | |
CREDS_PASSPHRASE: ${{ secrets.CREDS_PASSPHRASE }} | |
- run: tar xvf deploy-creds.tar | |
- 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 | |
- run: mkdir video | |
- name: Sync from cloud | |
run: aws s3 sync s3://sabbath-school-media`[[ "${{ steps.extract_branch.outputs.branch }}" = "stage" ]] && echo '-stage'`.adventech.io video --region us-east-1 --no-progress --exclude "*" --include "video/*/`node -e 'console.log(require("./deploy-helper.js").getCurrentQuarter())'`*/*.keep" --include "video/*/`node -e 'console.log(require("./deploy-helper.js").getNextQuarter())'`*/*.keep" --include "video/*/`node -e 'console.log(require("./deploy-helper.js").getPreviousQuarter())'`*/*.keep" | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- run: node deploy-video -b ${{ steps.extract_branch.outputs.branch }} -m "gen" | |
- run: rm -r video && mkdir video | |
- run: | | |
test -f curl-config-0.txt && for file in curl-config-*.txt; do | |
echo "Processing $file..." | |
curl -K "$file" | |
node deploy-video -b ${{ steps.extract_branch.outputs.branch }} -m "keep" | |
aws s3 sync ./video s3://sabbath-school-media`[[ "${{ steps.extract_branch.outputs.branch }}" = "stage" ]] && echo '-stage'`.adventech.io --acl "public-read" --region us-east-1 --no-progress | |
rm -r video | |
done || true | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
- run: node deploy-video -b ${{ steps.extract_branch.outputs.branch }} | |
- name: Web deploy | |
run: aws s3 cp dist/ s3://sabbath-school`[[ "${{ steps.extract_branch.outputs.branch }}" = "stage" ]] && echo '-stage'`.adventech.io --acl "public-read" --region us-east-1 --no-progress --recursive | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} |