containerapp/create-environment/README.md #104
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
schedule: | |
- cron: '0 13 * * 3' | |
workflow_dispatch: | |
name: 'containerapp/create-environment/README.md' | |
jobs: | |
validate: | |
runs-on: 'ubuntu-latest' | |
steps: | |
- uses: 'azure/login@v1' | |
with: | |
subscription-id: '${{ secrets.AZURE_SUBSCRIPTION_ID }}' | |
client-id: '${{ secrets.AZURE_CLIENT_ID }}' | |
tenant-id: '${{ secrets.AZURE_TENANT_ID }}' | |
- uses: 'actions/checkout@v3' | |
- run: | | |
if [[ -z $REGION ]]; then | |
export REGION=westus | |
fi | |
if [[ -z $RESOURCE_GROUP ]]; then | |
export RESOURCE_GROUP=joaz-rg-$RANDOM | |
echo "Using '"$RESOURCE_GROUP"' as resource group" | |
fi | |
az group create --name $RESOURCE_GROUP --location $REGION | |
az extension add --name containerapp --upgrade | |
az provider register --namespace Microsoft.App | |
az provider register --namespace Microsoft.OperationalInsights | |
if [[ -z $ACA_ENVIRONMENT_NAME ]]; then | |
export ACA_ENVIRONMENT_NAME=joazaca$RANDOM | |
export ACA_REGION=westus | |
fi | |
az containerapp env create \ | |
--name $ACA_ENVIRONMENT_NAME \ | |
--resource-group $RESOURCE_GROUP \ | |
--location "$ACA_REGION" || true | |
sleep 60 | |
sleep 60 | |
export RESULT=$(az containerapp env show --name $ACA_ENVIRONMENT_NAME --resource-group $RESOURCE_GROUP --output tsv --query properties.provisioningState) | |
az group delete --name $RESOURCE_GROUP --yes || true | |
if [[ "$RESULT" != Succeeded ]]; then | |
echo "Azure Container Apps environment $ACA_ENVIRONMENT_NAME was not provisioned properly" | |
exit 1 | |
fi | |
permissions: | |
contents: 'read' | |
id-token: 'write' |