SEO Image Update #95
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: SEO Image Update | |
on: | |
schedule: | |
- cron: "0 10 * * 5" # Runs "at 10 UTC every Friday" (see https://crontab.guru) | |
workflow_dispatch: # Runs on manual trigger | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Install dependencies | |
run: |- | |
python -m pip install --upgrade pip | |
pip install Pillow==9.3.0 | |
- name: Free space | |
run: df -h && rm -rf /opt/hostedtoolcache* && df -h | |
- name: Create Images | |
run: python code-generators/seo-image-creator.py | |
- name: Push to Branch | |
run: |- | |
if [[ $(git diff | wc -m) == 0 ]]; then | |
exit 0 | |
fi | |
BRANCH=github-action-seo-image-creator | |
git config user.name GitHub Actions | |
git config user.email [email protected] | |
git checkout -b $BRANCH | |
git add . | |
git commit -m "Code generated by seo-image-creator.py" | |
git push --set-upstream origin $BRANCH -f | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET }} | |
aws-region: us-west-1 | |
- name: Copy files to the S3 website content bucket | |
run: |- | |
mkdir -p ./Resources/social/writing-algorithms/indicators/supported-indicators | |
cp ./Resources/indicators/images/* ./Resources/social/writing-algorithms/indicators/supported-indicators | |
aws s3 cp ./Resources/social s3://${{ secrets.AWS_BUCKET }} --recursive --acl bucket-owner-full-control --exclude "*" --include "*.png" --content-type "image/png" |