-
Notifications
You must be signed in to change notification settings - Fork 0
70 lines (59 loc) · 1.84 KB
/
general.yml
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
---
name: general
"on":
workflow_dispatch:
schedule:
- cron: "0 5 * * *"
push:
branches:
- master
pull_request:
branches:
- master
permissions:
contents: read
jobs:
terraform:
runs-on: ubuntu-latest
steps:
- name: Checkout source
id: source
uses: actions/checkout@v4
- name: Setup terraform
id: terraform
uses: hashicorp/setup-terraform@v3
with:
terraform_version: latest
- name: Terraform format
id: fmt
run: bin/terraform fmt -no-color -check
- name: Terraform init
id: init
env:
GITHUB_TOKEN: ${{ secrets.INFRA_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bin/terraform init -no-color -input=false
- name: Terraform validate
id: validate
env:
GITHUB_TOKEN: ${{ secrets.INFRA_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bin/terraform validate -no-color
- name: Terraform plan
id: plan
env:
GITHUB_TOKEN: ${{ secrets.INFRA_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
run: bin/terraform plan -no-color -input=false
- name: Terraform apply
id: apply
env:
GITHUB_TOKEN: ${{ secrets.INFRA_TOKEN }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
if: github.ref == 'refs/heads/master' && github.event_name != 'pull_request'
run: bin/terraform apply -no-color -input=false -auto-approve
...