Aug 2023 (#20) #7
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: CI | |
on: | |
push: | |
branches: | |
- 'master' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
BUCKET: ${{ secrets.BUCKET }} | |
DISTRIBUTION_ID: ${{ secrets.DISTRIBUTION_ID }} | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Build | |
run: | | |
docker run \ | |
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ | |
jekyll/jekyll:3.8 /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v3 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: eu-west-1 | |
- name: Deploy | |
run: | | |
aws s3 sync _site/ s3://$BUCKET --content-type "text/html; charset=utf-8" --delete --cache-control "max-age=0" --exclude "*.sh" | |
aws s3 cp _site/assets/css/main-2019.css s3://$BUCKET/assets/css/main-2019.css --content-type="text/css" | |
aws cloudfront create-invalidation --distribution-id $DISTRIBUTION_ID --paths /\* |