functionapp/cosmosdb-output/README.md #122
This file contains hidden or 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 1 * * 4' | |
workflow_dispatch: | |
name: 'functionapp/cosmosdb-output/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 $REGION ]]; then | |
export REGION=westus3 | |
fi | |
curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg | |
sudo mv microsoft.gpg /etc/apt/trusted.gpg.d/microsoft.gpg | |
sudo sh -c 'echo "deb [arch=amd64] https://packages.microsoft.com/repos/microsoft-ubuntu-$(lsb_release -cs)-prod $(lsb_release -cs) main" > /etc/apt/sources.list.d/dotnetdev.list' | |
sudo apt-get update | |
sudo apt-get install azure-functions-core-tools-4 | |
func | |
if [[ -z $REGION ]]; then | |
export REGION=westus | |
fi | |
if [[ -z $RESOURCE_GROUP ]]; then | |
export RESOURCE_GROUP=joazrg-$RANDOM | |
echo "Using '"$RESOURCE_GROUP"' as resource group" | |
fi | |
az group create --name $RESOURCE_GROUP --location $REGION | |
if [[ -z $COSMOSDB_ACCOUNT_NAME ]]; then | |
export COSMOSDB_ACCOUNT_NAME=cosmosdb-$RANDOM | |
az cosmosdb create \ | |
--name $COSMOSDB_ACCOUNT_NAME \ | |
--resource-group $RESOURCE_GROUP \ | |
--locations regionName=eastus failoverPriority=0 | |
fi | |
cd functionapp/cosmosdb-output | |
export FUNCTIONS_COSMOSDB=functions-cosmosdb-$RANDOM | |
export FUNCTIONS_COSMOSDB_CONNECTION_STRING="$(az cosmosdb keys list --resource-group $RESOURCE_GROUP --name $COSMOSDB_ACCOUNT_NAME --type connection-strings --query 'connectionStrings[0].connectionString' --output tsv)" | |
mvn -P local validate | |
mvn -DresourceGroup=$RESOURCE_GROUP \ | |
-DappName=$FUNCTIONS_COSMOSDB \ | |
-Dregion=$REGION \ | |
package | |
mvn -DappName=$FUNCTIONS_COSMOSDB \ | |
-Dregion=$REGION \ | |
-DresourceGroup=$RESOURCE_GROUP \ | |
-DcosmosDBConnectionString="$FUNCTIONS_COSMOSDB_CONNECTION_STRING" \ | |
-DpricingTier=P1V3 \ | |
clean package azure-functions:deploy | |
cd ../.. | |
az group delete --name $RESOURCE_GROUP --yes || true | |
permissions: | |
contents: 'read' | |
id-token: 'write' |