Skip to content

chore: autopublish 2024-10-25T06:09:01Z #16

chore: autopublish 2024-10-25T06:09:01Z

chore: autopublish 2024-10-25T06:09:01Z #16

Workflow file for this run

name: deploy
on:
push:
branches:
- master
- stage
paths:
- '**.js'
- 'src/**'
- 'images/**'
jobs:
deploy:
if: (github.repository == 'Adventech/sabbath-school-lessons')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Get changed files and write the outputs to a JSON file
id: changed-files-write-output-files-json
uses: tj-actions/changed-files@v39
with:
json: true
write_output_files: true
- name: Verify the contents of the .github/outputs/all_changed_files.json file
run: |
cat .github/outputs/all_changed_files.json
- 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: npm install @Adventech/bible-tools
- run: node deploy -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 }}
deploy_v2:
if: (github.repository == 'Adventech/sabbath-school-lessons')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@v39
- name: List all changed files
run: |
for file in ${{ steps.changed-files.outputs.all_changed_files }}; do
echo "$file was changed"
done
- name: Get changed files and write the outputs to a JSON file
id: changed-files-write-output-files-json
uses: tj-actions/changed-files@v39
with:
json: true
write_output_files: true
- name: Verify the contents of the .github/outputs/all_changed_files.json file
run: |
cat .github/outputs/all_changed_files.json
- 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: npm install @Adventech/bible-tools
- run: node deploy -b ${{ steps.extract_branch.outputs.branch }} -v 2
- 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 }}
- name: Running porting to API v3 script
run: node port-to-v3.js
if: github.ref == 'refs/heads/stage'
- name: Upload ported assets
if: github.ref == 'refs/heads/stage' && hashFiles('dist/port/assets') != ''
run: aws s3 cp dist/port/assets s3://sabbath-school-resources-assets.adventech.io/assets/ --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 }}
- name: Install ImageMagick
if: github.ref == 'refs/heads/stage' && hashFiles('dist/port/ss') != ''
run: sudo apt-get update && sudo apt-get install -y imagemagick pngquant
- name: Generate square and landscape cover versions
if: github.ref == 'refs/heads/stage' && hashFiles('dist/port/ss') != ''
run: ./runners/overlay/overlay-find.sh
- name: Upload ported content
if: github.ref == 'refs/heads/stage' && hashFiles('dist/port/ss') != ''
run: aws s3 cp dist/port/ss s3://sabbath-school-media-tmp/port/ss-`echo '${{ github.run_id }}'` --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 }}
- name: Trigger workflow in sabbath-school-resources
if: github.ref == 'refs/heads/stage' && hashFiles('dist/port/ss') != ''
run: |
curl -X POST \
-H "Authorization: token ${{ secrets.PACKAGES_SECRET }}" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/Adventech/sabbath-school-resources/dispatches \
-d '{"event_type": "trigger-workflow", "client_payload": { "port_id": "${{ github.run_id }}" }}'