Update CloudFront
Use DuploCloud to update your CloudFront from Github Actions
Last updated
Was this helpful?
Use DuploCloud to update your CloudFront from Github Actions
Last updated
Was this helpful?
Was this helpful?
name: Build and Deploy
on:
# Triggers the workflow on push to matching branches
push:
branches:
- master
env:
duplo_host: https://mysystem.duplocloud.net # CHANGE ME!
duplo_token: "${{ secrets.DUPLO_TOKEN }}"
CLOUDFRONT_ID: mycloudfront # CHANGE ME!
TENANT_NAME: mytenant # CHANGE ME!
BUCKET_NAME: duploservices-mytenant-website-1234 # CHANGE ME!
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build_and_deploy:
runs-on: ubuntu-latest
needs:
- build
steps:
- name: Checkout
uses: actions/checkout@v4
# Build the website. CHANGE ME!
- name: CHANGE ME - Replace with your actual build logic
run: exit 1
# Deploy the website
- name: Get AWS credentials
uses: duplocloud/ghactions-aws-jit@master
with:
tenant: "${{ env.TENANT_NAME }}"
- name: Sync files to S3
run: |-
# Sync files to S3 from a local directory named "build"
aws s3 sync build/ "s3://$BUCKET_NAME/" --cache-control max-age=120,must-revalidate
- name: Invalidate Cloudfront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: "${{ env.CLOUDFRONT_ID }}"
PATHS: "/*"