|
1 | 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 |
| 2 | +# Manually triggered - dispatches ci-cd workflows in sibling repos, deploys scan demo, then tears down |
3 | 3 | # Prerequisite: Each sibling repo ci-cd.yml must include workflow_dispatch in its triggers |
4 | 4 |
|
5 | 5 | name: Deploy All Demo Apps |
|
13 | 13 | permissions: |
14 | 14 | id-token: write |
15 | 15 | contents: read |
16 | | - pages: write |
17 | 16 |
|
18 | 17 | jobs: |
19 | | - # ── Deploy demo apps 001-005 (all in parallel via cross-repo dispatch) ── |
20 | | - deploy-app-001: |
21 | | - name: Deploy App 001 (Rust) |
22 | | - uses: devopsabcs-engineering/a11y-demo-app-001/.github/workflows/ci-cd.yml@main |
23 | | - secrets: inherit |
24 | | - |
25 | | - deploy-app-002: |
26 | | - name: Deploy App 002 (C#) |
27 | | - uses: devopsabcs-engineering/a11y-demo-app-002/.github/workflows/ci-cd.yml@main |
28 | | - secrets: inherit |
29 | | - |
30 | | - deploy-app-003: |
31 | | - name: Deploy App 003 (Java) |
32 | | - uses: devopsabcs-engineering/a11y-demo-app-003/.github/workflows/ci-cd.yml@main |
33 | | - secrets: inherit |
34 | | - |
35 | | - deploy-app-004: |
36 | | - name: Deploy App 004 (Python) |
37 | | - uses: devopsabcs-engineering/a11y-demo-app-004/.github/workflows/ci-cd.yml@main |
38 | | - secrets: inherit |
39 | | - |
40 | | - deploy-app-005: |
41 | | - name: Deploy App 005 (Go) |
42 | | - uses: devopsabcs-engineering/a11y-demo-app-005/.github/workflows/ci-cd.yml@main |
43 | | - secrets: inherit |
44 | | - |
45 | | - # ── Deploy scan demo app (self repo, parallel with others) ── |
| 18 | + # ── Dispatch ci-cd workflows to sibling repos (all in parallel) ── |
| 19 | + dispatch-apps: |
| 20 | + name: Dispatch ${{ matrix.repo }} |
| 21 | + runs-on: ubuntu-latest |
| 22 | + strategy: |
| 23 | + fail-fast: false |
| 24 | + matrix: |
| 25 | + include: |
| 26 | + - repo: a11y-demo-app-001 |
| 27 | + name: App 001 (Rust) |
| 28 | + - repo: a11y-demo-app-002 |
| 29 | + name: App 002 (C#) |
| 30 | + - repo: a11y-demo-app-003 |
| 31 | + name: App 003 (Java) |
| 32 | + - repo: a11y-demo-app-004 |
| 33 | + name: App 004 (Python) |
| 34 | + - repo: a11y-demo-app-005 |
| 35 | + name: App 005 (Go) |
| 36 | + steps: |
| 37 | + - name: Trigger ci-cd workflow in ${{ matrix.repo }} |
| 38 | + env: |
| 39 | + GH_TOKEN: ${{ secrets.DISPATCH_PAT }} |
| 40 | + run: | |
| 41 | + echo "Dispatching ci-cd workflow for ${{ matrix.name }}..." |
| 42 | + gh workflow run ci-cd.yml \ |
| 43 | + --repo devopsabcs-engineering/${{ matrix.repo }} \ |
| 44 | + --ref main |
| 45 | + echo "Dispatch sent to ${{ matrix.repo }}" |
| 46 | +
|
| 47 | + - name: Wait for workflow to start |
| 48 | + env: |
| 49 | + GH_TOKEN: ${{ secrets.DISPATCH_PAT }} |
| 50 | + run: | |
| 51 | + echo "Waiting for workflow run to appear..." |
| 52 | + sleep 10 |
| 53 | + RUN_ID=$(gh run list \ |
| 54 | + --repo devopsabcs-engineering/${{ matrix.repo }} \ |
| 55 | + --workflow ci-cd.yml \ |
| 56 | + --limit 1 \ |
| 57 | + --json databaseId \ |
| 58 | + --jq '.[0].databaseId') |
| 59 | + echo "Workflow run started: $RUN_ID" |
| 60 | + echo "run_id=$RUN_ID" >> "$GITHUB_ENV" |
| 61 | +
|
| 62 | + - name: Wait for workflow to complete |
| 63 | + env: |
| 64 | + GH_TOKEN: ${{ secrets.DISPATCH_PAT }} |
| 65 | + run: | |
| 66 | + echo "Watching workflow run ${{ env.run_id }}..." |
| 67 | + gh run watch ${{ env.run_id }} \ |
| 68 | + --repo devopsabcs-engineering/${{ matrix.repo }} \ |
| 69 | + --exit-status |
| 70 | + echo "${{ matrix.repo }} deployment completed successfully" |
| 71 | +
|
| 72 | + # ── Deploy scan demo app (self repo, parallel with dispatch-apps) ── |
46 | 73 | deploy-scan-demo: |
47 | 74 | name: Deploy Scan Demo App (Next.js) |
48 | 75 | runs-on: ubuntu-latest |
@@ -110,11 +137,7 @@ jobs: |
110 | 137 | name: Teardown All Resources |
111 | 138 | runs-on: ubuntu-latest |
112 | 139 | needs: |
113 | | - - deploy-app-001 |
114 | | - - deploy-app-002 |
115 | | - - deploy-app-003 |
116 | | - - deploy-app-004 |
117 | | - - deploy-app-005 |
| 140 | + - dispatch-apps |
118 | 141 | - deploy-scan-demo |
119 | 142 | environment: teardown |
120 | 143 | steps: |
|
0 commit comments