Add files via upload #879
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: Upload Website | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
upload: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@master | |
- name: upload to unpublished bucket | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --metadata pdfsource=custom-pdfs --size-only | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_UNPUBLISHED_PRODUCTION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_PDF_UPLOADER_PRODUCTION }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_PDF_UPLOADER_PRODUCTION }} | |
AWS_REGION: 'eu-west-2' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'files' # optional: defaults to entire repository | |
- name: upload to published bucket | |
uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --metadata pdfsource=custom-pdfs --size-only | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET_PUBLISHED_PRODUCTION }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID_PDF_UPLOADER_PRODUCTION }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY_PDF_UPLOADER_PRODUCTION }} | |
AWS_REGION: 'eu-west-2' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'files' # optional: defaults to entire repository | |
- name: configure AWS credentials for cloudfront invalidation | |
uses: aws-actions/configure-aws-credentials@v1 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID_PDF_UPLOADER_PRODUCTION}} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY_PDF_UPLOADER_PRODUCTION }} | |
aws-region: 'eu-west-2' | |
- uses: badsyntax/github-action-aws-cloudfront@master | |
name: Invalidate assets.caselaw.nationalarchives.gov.uk | |
id: invalidate-cloudfront-cache | |
with: | |
distribution-id: ${{ secrets.AWS_ASSETS_DISTRIBUTION_ID }} | |
aws-region: 'eu-west-2' | |
origin-prefix: '' | |
include-origin-prefix: false | |
invalidate-paths: '/*' | |
default-root-object: 'index.html' |