|
| 1 | +# Orchestrating workflow: Deploy all demo apps and teardown after demo |
| 2 | +# Manually triggered - deploys all 6 apps in parallel, then tears down with approval |
| 3 | +# Prerequisite: Each sibling repo ci-cd.yml must include workflow_dispatch in its triggers |
| 4 | + |
| 5 | +name: Deploy All Demo Apps |
| 6 | + |
| 7 | +on: |
| 8 | + workflow_dispatch: |
| 9 | + |
| 10 | +env: |
| 11 | + LOCATION: canadacentral |
| 12 | + |
| 13 | +permissions: |
| 14 | + id-token: write |
| 15 | + contents: read |
| 16 | + |
| 17 | +jobs: |
| 18 | + # ── Deploy demo apps 001-005 (all in parallel via cross-repo dispatch) ── |
| 19 | + deploy-app-001: |
| 20 | + name: Deploy App 001 (Rust) |
| 21 | + uses: devopsabcs-engineering/a11y-demo-app-001/.github/workflows/ci-cd.yml@main |
| 22 | + secrets: inherit |
| 23 | + |
| 24 | + deploy-app-002: |
| 25 | + name: Deploy App 002 (C#) |
| 26 | + uses: devopsabcs-engineering/a11y-demo-app-002/.github/workflows/ci-cd.yml@main |
| 27 | + secrets: inherit |
| 28 | + |
| 29 | + deploy-app-003: |
| 30 | + name: Deploy App 003 (Java) |
| 31 | + uses: devopsabcs-engineering/a11y-demo-app-003/.github/workflows/ci-cd.yml@main |
| 32 | + secrets: inherit |
| 33 | + |
| 34 | + deploy-app-004: |
| 35 | + name: Deploy App 004 (Python) |
| 36 | + uses: devopsabcs-engineering/a11y-demo-app-004/.github/workflows/ci-cd.yml@main |
| 37 | + secrets: inherit |
| 38 | + |
| 39 | + deploy-app-005: |
| 40 | + name: Deploy App 005 (Go) |
| 41 | + uses: devopsabcs-engineering/a11y-demo-app-005/.github/workflows/ci-cd.yml@main |
| 42 | + secrets: inherit |
| 43 | + |
| 44 | + # ── Deploy scan demo app (self repo, parallel with others) ── |
| 45 | + deploy-scan-demo: |
| 46 | + name: Deploy Scan Demo App (Next.js) |
| 47 | + runs-on: ubuntu-latest |
| 48 | + steps: |
| 49 | + - uses: actions/checkout@v4 |
| 50 | + |
| 51 | + - name: Azure Login |
| 52 | + uses: azure/login@v2 |
| 53 | + with: |
| 54 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 55 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 56 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 57 | + |
| 58 | + - name: Deploy infrastructure |
| 59 | + run: | |
| 60 | + set -e |
| 61 | + az group create \ |
| 62 | + --name rg-a11y-scan-demo \ |
| 63 | + --location ${{ env.LOCATION }} |
| 64 | + az deployment group create \ |
| 65 | + --resource-group rg-a11y-scan-demo \ |
| 66 | + --name infra-deploy \ |
| 67 | + --template-file infra/main.bicep \ |
| 68 | + --parameters infra/main.parameters.json \ |
| 69 | + --parameters imageTag=${{ github.run_id }} |
| 70 | +
|
| 71 | + - name: Build and push Docker image |
| 72 | + run: | |
| 73 | + set -e |
| 74 | + ACR_NAME=$(az deployment group show \ |
| 75 | + --resource-group rg-a11y-scan-demo \ |
| 76 | + --name infra-deploy \ |
| 77 | + --query 'properties.outputs.acrName.value' -o tsv) |
| 78 | + echo "ACR: $ACR_NAME" |
| 79 | + az acr build \ |
| 80 | + --registry "$ACR_NAME" \ |
| 81 | + --image a11y-scan-demo:${{ github.run_id }} . |
| 82 | +
|
| 83 | + - name: Deploy container to Web App |
| 84 | + run: | |
| 85 | + set -e |
| 86 | + WEB_APP_NAME=$(az deployment group show \ |
| 87 | + --resource-group rg-a11y-scan-demo \ |
| 88 | + --name infra-deploy \ |
| 89 | + --query 'properties.outputs.webAppName.value' -o tsv) |
| 90 | + ACR_LOGIN=$(az deployment group show \ |
| 91 | + --resource-group rg-a11y-scan-demo \ |
| 92 | + --name infra-deploy \ |
| 93 | + --query 'properties.outputs.acrLoginServer.value' -o tsv) |
| 94 | + az webapp config container set \ |
| 95 | + --name $WEB_APP_NAME \ |
| 96 | + --resource-group rg-a11y-scan-demo \ |
| 97 | + --container-image-name "$ACR_LOGIN/a11y-scan-demo:${{ github.run_id }}" |
| 98 | + az webapp restart \ |
| 99 | + --name $WEB_APP_NAME \ |
| 100 | + --resource-group rg-a11y-scan-demo |
| 101 | + SITE_URL=$(az deployment group show \ |
| 102 | + --resource-group rg-a11y-scan-demo \ |
| 103 | + --name infra-deploy \ |
| 104 | + --query 'properties.outputs.webAppUrl.value' -o tsv) |
| 105 | + echo "Deployed scan demo app to: $SITE_URL" |
| 106 | +
|
| 107 | + # ── Teardown (requires approval via 'teardown' environment) ── |
| 108 | + teardown: |
| 109 | + name: Teardown All Resources |
| 110 | + runs-on: ubuntu-latest |
| 111 | + needs: |
| 112 | + - deploy-app-001 |
| 113 | + - deploy-app-002 |
| 114 | + - deploy-app-003 |
| 115 | + - deploy-app-004 |
| 116 | + - deploy-app-005 |
| 117 | + - deploy-scan-demo |
| 118 | + environment: teardown |
| 119 | + steps: |
| 120 | + - name: Azure Login |
| 121 | + uses: azure/login@v2 |
| 122 | + with: |
| 123 | + client-id: ${{ secrets.AZURE_CLIENT_ID }} |
| 124 | + tenant-id: ${{ secrets.AZURE_TENANT_ID }} |
| 125 | + subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} |
| 126 | + |
| 127 | + - name: Delete rg-a11y-demo-app-001 |
| 128 | + run: | |
| 129 | + if az group exists --name rg-a11y-demo-app-001 | grep -q true; then |
| 130 | + echo "Deleting resource group: rg-a11y-demo-app-001" |
| 131 | + az group delete --name rg-a11y-demo-app-001 --yes --no-wait |
| 132 | + echo "Deletion initiated for rg-a11y-demo-app-001" |
| 133 | + else |
| 134 | + echo "Resource group rg-a11y-demo-app-001 does not exist, skipping." |
| 135 | + fi |
| 136 | +
|
| 137 | + - name: Delete rg-a11y-demo-app-002 |
| 138 | + run: | |
| 139 | + if az group exists --name rg-a11y-demo-app-002 | grep -q true; then |
| 140 | + echo "Deleting resource group: rg-a11y-demo-app-002" |
| 141 | + az group delete --name rg-a11y-demo-app-002 --yes --no-wait |
| 142 | + echo "Deletion initiated for rg-a11y-demo-app-002" |
| 143 | + else |
| 144 | + echo "Resource group rg-a11y-demo-app-002 does not exist, skipping." |
| 145 | + fi |
| 146 | +
|
| 147 | + - name: Delete rg-a11y-demo-app-003 |
| 148 | + run: | |
| 149 | + if az group exists --name rg-a11y-demo-app-003 | grep -q true; then |
| 150 | + echo "Deleting resource group: rg-a11y-demo-app-003" |
| 151 | + az group delete --name rg-a11y-demo-app-003 --yes --no-wait |
| 152 | + echo "Deletion initiated for rg-a11y-demo-app-003" |
| 153 | + else |
| 154 | + echo "Resource group rg-a11y-demo-app-003 does not exist, skipping." |
| 155 | + fi |
| 156 | +
|
| 157 | + - name: Delete rg-a11y-demo-app-004 |
| 158 | + run: | |
| 159 | + if az group exists --name rg-a11y-demo-app-004 | grep -q true; then |
| 160 | + echo "Deleting resource group: rg-a11y-demo-app-004" |
| 161 | + az group delete --name rg-a11y-demo-app-004 --yes --no-wait |
| 162 | + echo "Deletion initiated for rg-a11y-demo-app-004" |
| 163 | + else |
| 164 | + echo "Resource group rg-a11y-demo-app-004 does not exist, skipping." |
| 165 | + fi |
| 166 | +
|
| 167 | + - name: Delete rg-a11y-demo-app-005 |
| 168 | + run: | |
| 169 | + if az group exists --name rg-a11y-demo-app-005 | grep -q true; then |
| 170 | + echo "Deleting resource group: rg-a11y-demo-app-005" |
| 171 | + az group delete --name rg-a11y-demo-app-005 --yes --no-wait |
| 172 | + echo "Deletion initiated for rg-a11y-demo-app-005" |
| 173 | + else |
| 174 | + echo "Resource group rg-a11y-demo-app-005 does not exist, skipping." |
| 175 | + fi |
| 176 | +
|
| 177 | + - name: Delete rg-a11y-scan-demo |
| 178 | + run: | |
| 179 | + if az group exists --name rg-a11y-scan-demo | grep -q true; then |
| 180 | + echo "Deleting resource group: rg-a11y-scan-demo" |
| 181 | + az group delete --name rg-a11y-scan-demo --yes --no-wait |
| 182 | + echo "Deletion initiated for rg-a11y-scan-demo" |
| 183 | + else |
| 184 | + echo "Resource group rg-a11y-scan-demo does not exist, skipping." |
| 185 | + fi |
| 186 | +
|
| 187 | + - name: Teardown summary |
| 188 | + run: | |
| 189 | + echo "Teardown initiated for all resource groups." |
| 190 | + echo "Resource group deletions are running asynchronously." |
0 commit comments