generated from Azure-Samples/deployment-environments-cicd-tutorial
-
Notifications
You must be signed in to change notification settings - Fork 0
45 lines (35 loc) · 1.27 KB
/
environment_delete.yml
File metadata and controls
45 lines (35 loc) · 1.27 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
name: Delete Environment
permissions:
id-token: write
on:
delete:
pull_request:
types: [closed]
concurrency: ${{ github.event.number || github.ref_name }}
jobs:
config:
if: github.event_name == 'pull_request' || github.event.ref_type == 'branch'
name: Get Configuration
uses: ./.github/workflows/environment_config.yml
delete_env:
if: github.event_name == 'pull_request' || github.event.ref_type == 'branch'
name: Delete ${{ needs.config.outputs.type }} Environment
runs-on: ubuntu-latest
needs: config
environment: ${{ needs.config.outputs.type }}
env:
ENVIRONMENT_NAME: ${{ needs.config.outputs.name }}
ENVIRONMENT_TYPE: ${{ needs.config.outputs.type }}
steps:
- name: Install DevCenter CLI Extension
run: az extension add --name devcenter --upgrade
- name: Az CLI login
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ vars.AZURE_TENANT_ID }}
subscription-id: ${{ vars.AZURE_SUBSCRIPTION_ID }}
- name: Delete Environment
run: |
az devcenter dev environment delete --name ${{ env.ENVIRONMENT_NAME }} \
--dev-center ${{ vars.AZURE_DEVCENTER }} --project ${{ vars.AZURE_PROJECT }} --yes