-
Notifications
You must be signed in to change notification settings - Fork 0
63 lines (58 loc) · 2.08 KB
/
deploy.yml
File metadata and controls
63 lines (58 loc) · 2.08 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
name: Deploy evently
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
# important for azure/login
permissions:
id-token: write
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Azure Login
uses: azure/login@v2
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: Validate Azure CLI can be used
uses: azure/cli@v2
with:
azcliversion: latest
inlineScript: |
az account show
- name: Set up Terraform
uses: hashicorp/setup-terraform@v3
- name: Terraform init
run: |
cd deploy/Terraform
terraform init
- name: Terraform validate
run: |
cd deploy/Terraform
terraform validate
- name: Terraform plan
run: |
cd deploy/Terraform
terraform plan
env:
TF_VAR_sql_admin_username: ${{ secrets.TF_VAR_SQL_ADMIN_USERNAME }}
TF_VAR_sql_admin_password: ${{ secrets.TF_VAR_SQL_ADMIN_PASSWORD }}
TF_VAR_google_client_id: ${{ secrets.TF_VAR_GOOGLE_CLIENT_ID }}
TF_VAR_google_client_secret: ${{ secrets.TF_VAR_GOOGLE_CLIENT_SECRET }}
TF_VAR_email_from: ${{ secrets.TF_VAR_EMAIL_FROM }}
TF_VAR_smtp_password: ${{ secrets.TF_VAR_SMTP_PASSWORD }}
# Apply step can be skipped for pull requests
- name: Terraform apply
run: cd deploy/Terraform && terraform apply -auto-approve
env:
TF_VAR_sql_admin_username: ${{ secrets.TF_VAR_SQL_ADMIN_USERNAME }}
TF_VAR_sql_admin_password: ${{ secrets.TF_VAR_SQL_ADMIN_PASSWORD }}
TF_VAR_google_client_id: ${{ secrets.TF_VAR_GOOGLE_CLIENT_ID }}
TF_VAR_google_client_secret: ${{ secrets.TF_VAR_GOOGLE_CLIENT_SECRET }}
TF_VAR_email_from: ${{ secrets.TF_VAR_EMAIL_FROM }}
TF_VAR_smtp_password: ${{ secrets.TF_VAR_SMTP_PASSWORD }}