6
6
deploy :
7
7
required : true
8
8
type : boolean
9
+ branchName :
10
+ required : true
11
+ type : string
12
+
9
13
# secrets:
10
14
# personal_access_token:
11
15
# required: true
12
16
# Map the workflow outputs to job outputs
17
+
13
18
outputs :
14
19
container-app-url :
15
20
description : " The URL of the deployed container app"
18
23
env :
19
24
RESOURCE_GROUP : rg-poorclaresarundel
20
25
REGISTRY : ghcr.io
21
- BRANCH_NAME : ${{ github.head_ref || github.ref_name }}
22
26
23
27
jobs :
24
28
build :
@@ -101,14 +105,19 @@ jobs:
101
105
uses : azure/CLI@v2
102
106
with :
103
107
inlineScript : |
104
- REF_SHA="${{ env.BRANCH_NAME }}.${{ needs.build.outputs.sha-short }}"
108
+ BRANCH_NAME="${{ inputs.branchName }}"
109
+ REF_SHA="${{ inputs.branchName }}.${{ needs.build.outputs.sha-short }}"
105
110
DEPLOYMENT_NAME="${REF_SHA////-}"
106
111
echo "DEPLOYMENT_NAME=$DEPLOYMENT_NAME"
107
112
108
113
webServiceImage="${{ needs.build.outputs.image-name }}:sha-${{ needs.build.outputs.sha-short }}"
109
114
echo "webServiceImage=$webServiceImage"
110
115
111
- webServiceContainerAppName='${{ env.BRANCH_NAME }}-web'
116
+ if [ "$BRANCH_NAME" == "main" ]; then
117
+ webServiceContainerAppName="main-web"
118
+ else
119
+ webServiceContainerAppName="preview-web"
120
+ fi
112
121
echo "webServiceContainerAppName=$webServiceContainerAppName"
113
122
114
123
TAGS='{"owner":"johnnyreilly", "email":"johnny_reilly@hotmail.com"}'
@@ -121,7 +130,7 @@ jobs:
121
130
containerRegistry=${{ env.REGISTRY }} \
122
131
containerRegistryUsername=${{ github.actor }} \
123
132
containerRegistryPassword=${{ secrets.PACKAGES_TOKEN }} \
124
- branchName='${{ env. BRANCH_NAME }}' \
133
+ branchName="$ BRANCH_NAME" \
125
134
workspaceName='shared-log-analytics' \
126
135
appInsightsName='shared-app-insights' \
127
136
managedEnvironmentName='shared-env' \
0 commit comments