-
Notifications
You must be signed in to change notification settings - Fork 90
84 lines (65 loc) · 2.36 KB
/
7-subscriptions.yml
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
# ----------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation.
# Licensed under the MIT license.
#
# THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
# EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
# OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
# ----------------------------------------------------------------------------------
name: 7 - Subscriptions
on:
workflow_dispatch:
inputs:
subscriptionIds:
type: string
description: Subscription ID(s), e.g. "abcd", "1234"
required: true
environmentName:
type: string
description: Environment name (optional), e.g. CanadaPubSecALZ-main
required: false
defaults:
run:
shell: pwsh
working-directory: scripts/deployments
jobs:
SubscriptionMatrix:
if: github.event.inputs.subscriptionIds != ''
name: Create subscription deployment(s) as matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout
uses: actions/checkout@v3
- id: set-matrix
run: |
$SubscriptionIdJsonObject = @{
SubscriptionId = ${{github.event.inputs.subscriptionIds}} -Split ","
}
$SubscriptionIdJson = $SubscriptionIdJsonObject | ConvertTo-Json -Compress
Write-Output "::set-output name=matrix::$SubscriptionIdJson"
Subscriptions:
if: github.event.inputs.subscriptionIds != ''
needs:
- SubscriptionMatrix
name: Subscriptions
runs-on: ubuntu-latest
strategy:
matrix: ${{fromJSON(needs.SubscriptionMatrix.outputs.matrix)}}
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Configure PowerShell modules
run: |
Install-Module Az -Force
Install-Module powershell-yaml -Force
- name: Deploy Subscription
run: |
./RunWorkflows.ps1 `
-DeploySubscriptionIds '${{ matrix.subscriptionId }}' `
-EnvironmentName '${{github.event.inputs.environmentName}}' `
-LoginServicePrincipalJson (ConvertTo-SecureString -String '${{secrets.ALZ_CREDENTIALS}}' -AsPlainText -Force) `
-GitHubRepo ${env:GITHUB_REPOSITORY} `
-GitHubRef ${env:GITHUB_REF}