Skip to content

Commit 14b3a21

Browse files
committed
Updated Workflow Letest
1 parent 266513d commit 14b3a21

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

.github/workflows/build-deploy.yml

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,30 @@ jobs:
100100
echo "Green slot already exists"
101101
fi
102102
103+
# ------------------- Determine Idle Slot -------------------
104+
- name: Determine Idle Slot
105+
id: idle-slot
106+
run: |
107+
RESOURCE_GROUP=${{ secrets.AZURE_RESOURCE_GROUP }}
108+
APP_NAME=${{ secrets.AZURE_APP_NAME }}
109+
110+
PROD_IMAGE=$(az webapp config container show \
111+
--name $APP_NAME \
112+
--resource-group $RESOURCE_GROUP \
113+
--query "linuxFxVersion" -o tsv)
114+
115+
SLOT_BLUE_IMAGE=$(az webapp config container show --name $APP_NAME --resource-group $RESOURCE_GROUP --slot blue --query "linuxFxVersion" -o tsv)
116+
SLOT_GREEN_IMAGE=$(az webapp config container show --name $APP_NAME --resource-group $RESOURCE_GROUP --slot green --query "linuxFxVersion" -o tsv)
117+
118+
if [[ "$SLOT_BLUE_IMAGE" == "$PROD_IMAGE" ]]; then
119+
IDLE_SLOT="green"
120+
else
121+
IDLE_SLOT="blue"
122+
fi
123+
124+
echo "slot_name=$IDLE_SLOT" >> $GITHUB_ENV
125+
echo "Idle slot chosen: $IDLE_SLOT"
126+
103127
# ------------------- Deploy to Idle Slot -------------------
104128
- name: Deploy to Idle Slot
105129
run: |

0 commit comments

Comments
 (0)