Skip to content

Latest commit

 

History

History
executable file
·
46 lines (34 loc) · 2.55 KB

File metadata and controls

executable file
·
46 lines (34 loc) · 2.55 KB

CI/CD

Here we will create an Azure App service, allow your GitHub repository to publish to Azure, and create a Github Action to test and deploy your app

Azure

Creating an App Service

Create an App Service app using an ARM template: (https://learn.microsoft.com/en-us/azure/app-service/quickstart-arm-template?pivots=platform-linux) Before moving forward, consider Azure App Service on Linux pricing and change the sku accordingly.

Python Version

Inside the app_service.json "Python 3.12" is the cureently configured runtime. To see all currently available Python versions you could to this:

az login
az webapp list-runtimes --os linux | grep PYTHON

Please note: If you made any changes to the app_service.json file you need to modity the link below, so that it points to the ./arm/app_service.json file in your repository.

Deploy to Azure

Clicking the button will log you into Azure and create an Azure App Service as it is declared in the ./arm/app_service.json file.

  • Select the appropriate subscrition (in case your account has multiple subscriptions.)
  • Select an existing, or create a new Resource Group, (I create a new resource group and named it 'rc_dca'.)
  • Select a region (if you using the free Sku (F1), make sure you are not already running a Linux/Python app in the selected region.)
  • Click "Review + create" (very bottom of the page.)
  • Click "Create" on the next page.

Download the the "Publish Profile"

Still on the Azure Portal, navigate to "Home", the "App Services" and click on your web-app, something like 'webApp-rh5ds...'

  • There you can download the "Publish Profile", an XML file.
  • Click on "Download"

GitHub

Allowing Github to deploy to Azure

GitHub Actions makes it easy to automate all your software workflows, now with world-class CI/CD. Build, test, and deploy your code right from GitHub.

Add a secret in your repository

  • On https://github.com goto to your repo and open its setting. Click on 'Secrets and variables', click on 'Actions', and create a 'Repository secret' in your repository and name it AZURE_WEBAPP_PUBLISH_PROFILE and use the publish profile contents (the xml file you downloaded in the previous stop) as the value of the secret.

Next