Skip to content

Commit a456f24

Browse files
committed
add deployment functionality
1 parent 28d03ee commit a456f24

File tree

1 file changed

+27
-1
lines changed

1 file changed

+27
-1
lines changed

.github/workflows/main.yml

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,4 +80,30 @@ jobs:
8080
- name: Terraform Apply
8181
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
8282
run: terraform apply -auto-approve -input=false
83-
working-directory: ./2-Terraform-AZURE-Services-Creation/4-aks
83+
working-directory: ./2-Terraform-AZURE-Services-Creation/4-aks
84+
85+
- name: Create GitHub Deployment
86+
if: github.ref == 'refs/heads/main'
87+
id: deployment
88+
uses: chrnorm/deployment-action@v2
89+
with:
90+
token: ${{ github.token }}
91+
environment: production
92+
description: "Deployment from main branch"
93+
94+
- name: Update Deployment Status (Success)
95+
if: success() && github.ref == 'refs/heads/main'
96+
uses: chrnorm/deployment-status@v2
97+
with:
98+
token: ${{ github.token }}
99+
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
100+
state: "success"
101+
environment-url: https://portal.azure.com/#resource/subscriptions/${{ secrets.AZURE_SUBSCRIPTION_ID }}/resourceGroups/thomasthorntoncloud/providers/Microsoft.ContainerService/managedClusters/devopsthehardwayaks
102+
103+
- name: Update Deployment Status (Failure)
104+
if: failure() && github.ref == 'refs/heads/main'
105+
uses: chrnorm/deployment-status@v2
106+
with:
107+
token: ${{ github.token }}
108+
deployment-id: ${{ steps.deployment.outputs.deployment_id }}
109+
state: "failure"

0 commit comments

Comments
 (0)