-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
81 lines (72 loc) · 2.38 KB
/
action.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
71
72
73
74
75
76
77
78
79
80
81
name: "OpEx Dashboard"
description: "Automate OpEx Dashboard generation process"
inputs:
client-id:
description: "Azure client-id"
required: true
tenant-id:
description: "Azure tenant-id"
required: true
subscription-id:
description: "Azure subscription-id"
required: true
config:
description: "A yaml file with all params to create the template"
required: true
api-name:
description: "Api name"
required: true
environment:
description: "Environment"
required: true
docker-version:
description: "docker version"
required: true
template-dir:
description: "Temp directory"
required: true
default: azure-dashboard
terraform-version:
description: "Override terraform version"
required: true
default: "1.3.6"
runs:
using: "composite"
steps:
# this action create a folder named /azure-dashboard
- name: Run opex dashbaord
shell: bash
run: |
docker run \
--workdir /github/workspace --rm \
-v $(pwd):"/github/workspace" \
ghcr.io/pagopa/opex-dashboard-azure-action@${{ inputs.docker-version }} ${{ inputs.template-dir }} ${{ inputs.config }}
# we need to set env variables in the folder /azure-dashboard
- name: Copy Environments
shell: bash
run: |
cp -R .opex/${{ inputs.api-name }}/env ./${{ inputs.template-dir }}
- name: Setup Terraform
id: setup_terraform
# from https://github.com/hashicorp/setup-terraform/commits/main
uses: hashicorp/setup-terraform@8feba2b913ea459066180f9cb177f58a881cf146
with:
terraform_version: ${{ inputs.terraform-version }}
- name: Login
id: login
# from https://github.com/Azure/login/commits/master
uses: azure/login@92a5484dfaf04ca78a94597f4f19fea633851fa2
with:
client-id: ${{ inputs.client-id }}
tenant-id: ${{ inputs.tenant-id }}
subscription-id: ${{ inputs.subscription-id }}
# now is possible to launch the command: terraform apply
- name: Terraform Apply
shell: bash
run: |
cd ./${{ inputs.template-dir }}
export ARM_CLIENT_ID="${{ inputs.client-id }}"
export ARM_TENANT_ID="${{ inputs.tenant-id }}"
export ARM_SUBSCRIPTION_ID="${{ inputs.subscription-id }}"
export ARM_USE_OIDC=true
bash ./terraform.sh apply ${{ inputs.environment }} -auto-approve