Alan Castro
Posted on May 24, 2020
Here is the .gitlab-ci.yml
that I use to deploy my .NET Core 3.1 azure web app in Gitlab CI/CD.
Variables that I use in the scripts:
- $AZ_SERVICE_PRINCIPAL_URL
- $AZ_SERVICE_PRINCIPAL_SECRET
- $AZ_SERVICE_PRINCIPAL_TENANT
- $AZ_APP_NAME
- $AZ_APP_RESOURCE_GROUP
stages:
- deploy
deploy:
stage: deploy
image: mcr.microsoft.com/dotnet/core/sdk:3.1
script:
- apt-get update && apt-get -y install zip
- curl -sL https://aka.ms/InstallAzureCLIDeb | bash
- az login --service-principal -u $AZ_SERVICE_PRINCIPAL_URL -p $AZ_SERVICE_PRINCIPAL_SECRET --tenant
$AZ_SERVICE_PRINCIPAL_TENANT
- dotnet restore --configfile ./NuGet.config
- dotnet publish -c release -o out
- cd out && zip -r app.zip .
- az webapp deployment source config-zip -n $AZ_APP_NAME -g $AZ_APP_RESOURCE_GROUP --src app.zip
only:
- master
Hope it's useful
💖 💪 🙅 🚩
Alan Castro
Posted on May 24, 2020
Join Our Newsletter. No Spam, Only the good stuff.
Sign up to receive the latest update from our blog.