Skip to content

Merge pull request #8 from jSherz/dependabot/bundler/jekyll-4.3.4 #80

Merge pull request #8 from jSherz/dependabot/bundler/jekyll-4.3.4

Merge pull request #8 from jSherz/dependabot/bundler/jekyll-4.3.4 #80

name: 'Website'
on:
push:
branches:
- main
pull_request:
jobs:
deploy:
name: 'deploy'
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
permissions:
contents: read
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Ruby and install dependencies
uses: ruby/setup-ruby@v1
with:
ruby-version: 3.1.6
bundler-cache: true
- name: Build
run: bundle exec jekyll build
- name: Authenticate with AWS
uses: aws-actions/configure-aws-credentials@v4
with:
role-to-assume: arn:aws:iam::262312054792:role/jsherz-com-github-actions
aws-region: eu-west-1
- name: Sync files to S3
run: |
aws s3 sync \
--metadata-directive REPLACE \
--cache-control "max-age=86400" \
_site/ s3://jsj-prod-jsherz-com-website/
- name: Clear cache
run: |
DISTRIBUTION_ID=$(aws cloudfront list-distributions | jq --raw-output '.DistributionList.Items | map(select((.Aliases.Quantity >= 1) and (.Aliases.Items | contains(["jsherz.com"])))) | .[0].Id')
export PAGER=""
aws cloudfront create-invalidation --distribution-id ${DISTRIBUTION_ID} --path '/*'