nw-252: new 6sense tag (#241) #60
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: Build site with Jekyll and upload to S3 | |
on: [push, workflow_dispatch] | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Build the site in the jekyll/builder container | |
run: | | |
docker run \ | |
-v ${{ github.workspace }}:/srv/jekyll -v ${{ github.workspace }}/_site:/srv/jekyll/_site \ | |
jekyll/builder:latest /bin/bash -c "chmod -R 777 /srv/jekyll && jekyll build --future" | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-east-1 | |
- name: Deploy the site to S3 on merge to master | |
if: github.ref == 'refs/heads/master' | |
run: | | |
aws s3 sync _site ${{ secrets.AWS_S3_BUCKET }} --acl public-read | |
- name: Create CF invalidation | |
if: github.ref == 'refs/heads/master' | |
run: | | |
aws configure set preview.cloudfront true && \ | |
aws cloudfront create-invalidation --distribution-id ${{ secrets.AWS_CLOUDFRONT_DIST_ID }} --paths '/*' |