77 paths :
88 - ' generate-url-shortene/infrastructure/**'
99 pull_request :
10+ branches :
11+ - main
1012 paths :
1113 - ' generate-url-shortene/infrastructure/**'
1214 workflow_dispatch : # Allows you to run the workflow manually
@@ -18,7 +20,63 @@ permissions:
1820jobs :
1921 deploy-dev :
2022 runs-on : ubuntu-latest
21- environment : development
23+ environment : Development
24+ steps :
25+ - uses : actions/checkout@v4
26+
27+ - name : Azure Login
28+ 29+ with :
30+ creds : ${{ secrets.AZURE_CREDENTIALS }}
31+
32+ 33+ with :
34+ inlineScript : |
35+ #!/bin/bash
36+ az group create --name ${{ vars.RESOURCE_GROUP_NAME }} --location ${{ vars.RESOURCE_GROUP_LOCATION }}
37+ echo "Resource Group Created"
38+
39+ - name : Deploy Bicep Template
40+ uses : azure/arm-deploy@v2
41+ with :
42+ scope : resourcegroup
43+ resourceGroupName : ${{ vars.RESOURCE_GROUP_NAME }}
44+ template : ./infrastructure/main.bicep
45+ failOnStdErr : true
46+
47+ deploy-stg :
48+ runs-on : ubuntu-latest
49+ needs : deploy-dev
50+ environment : Staging
51+ steps :
52+ - uses : actions/checkout@v4
53+
54+ - name : Azure Login
55+ 56+ with :
57+ creds : ${{ secrets.AZURE_CREDENTIALS }}
58+
59+ 60+ with :
61+ inlineScript : |
62+ #!/bin/bash
63+ az group create --name ${{ vars.RESOURCE_GROUP_NAME }} --location ${{ vars.RESOURCE_GROUP_LOCATION }}
64+ echo "Resource Group Created"
65+
66+ - name : Deploy Bicep Template
67+ uses : azure/arm-deploy@v2
68+ with :
69+ scope : resourcegroup
70+ resourceGroupName : ${{ vars.RESOURCE_GROUP_NAME }}
71+ template : ./infrastructure/main.bicep
72+ failOnStdErr : true
73+
74+ deploy-prod :
75+
76+ runs-on : ubuntu-latest
77+ needs : deploy-stg
78+ if : github.event_name == 'push' && github.ref == 'refs/heads/main'
79+ environment : Production
2280 steps :
2381 - uses : actions/checkout@v4
2482
4098 scope : resourcegroup
4199 resourceGroupName : ${{ vars.RESOURCE_GROUP_NAME }}
42100 template : ./infrastructure/main.bicep
43- failOnStdErr : true
101+ failOnStdErr : true
0 commit comments