Skip to content

Commit

Permalink
ci: sync build to s3 bucket
Browse files Browse the repository at this point in the history
We push changes to s3, and not to Docker Hub.
  • Loading branch information
regisb committed Apr 17, 2024
1 parent 3e1dd3a commit b289d4c
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 31 deletions.
36 changes: 36 additions & 0 deletions .github/workflows/deploy_s3.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# 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 }}
29 changes: 0 additions & 29 deletions .github/workflows/push.yml

This file was deleted.

4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ clean: ## Clean any existing site
rm -rf contents/_build

build: clean ## Build site
@python build.py
@cp -r layout/static _build/academy/static
python build.py
cp -r layout/static _build/academy/static

watch: build ## Watch for changes and build site
while true; do $(MAKE) wait-for-change build || true; done
Expand Down

0 comments on commit b289d4c

Please sign in to comment.