-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (63 loc) · 2.03 KB
/
deploy.yml
File metadata and controls
77 lines (63 loc) · 2.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Deploy
on:
push:
branches:
- main
# branches that match deploy-* will deploy as well
- deploy-*
workflow_dispatch:
env:
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_DEFAULT_REGION: us-east-1
working_dir: terragrunt/live/website
concurrency:
group: ${{ github.workflow }}
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v5
- name: Update Terraform State and Providers
uses: gruntwork-io/terragrunt-action@v3
# env:
# TF_LOG: DEBUG
# INPUT_PRE_EXEC_1: |
# echo "Current directory: $(pwd)"
# ls -la
# git status
with:
tg_dir: ${{ env.working_dir }}
tg_command: init --upgrade
- name: Terragrunt Plan
uses: gruntwork-io/terragrunt-action@v3
with:
tg_dir: ${{ env.working_dir }}
tg_command: plan
- name: Terragrunt Apply
uses: gruntwork-io/terragrunt-action@v3
with:
tg_dir: ${{ env.working_dir }}
tg_command: apply
- name: Terragrunt Output
uses: gruntwork-io/terragrunt-action@v3
id: terragrunt_output
env:
TG_TF_FORWARD_STDOUT: 1
TG_NO_COLOR: 1
with:
tg_dir: ${{ env.working_dir }}
tg_command: output
- name: Read Values
run: |
echo "Bucket Name: ${{ steps.terragrunt_step.outputs.bucket_name }}"
echo "Distribution ID: ${{ steps.terragrunt_step.outputs.distribution_id }}
- name: Build Jekyll project
run: |
bundle install
bundle exec rake build
# TODO: fail workflow if bucket name or distribution_id is not found
- name: Copy output to S3
run: aws s3 sync ./_site/ s3://${{ steps.terragrunt_step.outputs.bucket_name }} --acl public-read --delete --cache-control max-age=604800
- name: Invalidate Cloudfront
run: aws cloudfront create-invalidation --distribution-id ${{ steps.terragrunt_step.outputs.distribution_id }} --paths "/*"