Merge pull request #1719 from dje/dependabot/terraform/terraform/hash… #1848
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: 'Deployment' | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
name: 'Deploy' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Configure AWS Credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: us-west-2 | |
- name: Setup Terraform | |
uses: hashicorp/setup-terraform@v3 | |
- name: Terraform Init | |
run: cd terraform && terraform init | |
- name: Terraform Format | |
run: cd terraform && terraform fmt -check | |
continue-on-error: true | |
- name: Terraform Plan | |
run: cd terraform && terraform plan | |
- name: Terraform Apply | |
run: cd terraform && terraform apply -auto-approve | |
- name: Terraform CloudFront Distribution ID | |
id: cfid | |
run: cd terraform && terraform output cfdist | |
- name: AWS Directory Sync | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: aws s3 sync public s3://darrineden.com/ --delete --acl public-read | |
- name: AWS Invalidate CloudFront Distribution | |
if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
run: AWS_PAGER="" aws cloudfront create-invalidation --paths "/*" --distribution-id ${{ steps.cfid.outputs.stdout }} |