ci: sync build to s3 bucket #1
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
# Build site and sync with S3 | |
# To test this action with act (https://github.com/nektos/act) run: | |
# act --secret ACADEMY_S3_ACCESS_KEY_ID=xxx --secret ACADEMY_S3_SECRET_ACCESS_KEY=xxx --secret ACADEMY_S3_REGION=xxx --secret ACADEMY_S3_BUCKET=xxx | |
name: Deploy to S3 | |
on: | |
push: | |
branches: [ master, main ] | |
jobs: | |
deploy_to_s3: | |
name: Build and sync with S3 | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v4 | |
- name: Install Python requirements | |
run: pip install -r requirements.txt | |
- name: Install system requirements | |
run: apt update && apt install -y pandoc | |
- name: Build site | |
run: make build | |
# https://github.com/aws-actions/configure-aws-credentials?tab=readme-ov-file#assumerole-with-static-iam-credentials-in-repository-secrets | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.ACADEMY_S3_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.ACADEMY_S3_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.ACADEMY_S3_REGION }} | |
- name: Sync build assets with S3 | |
run: aws s3 sync --delete _build/academy/ s3://${{ secrets.ACADEMY_S3_BUCKET }} |