Overview

The Clean.Net template includes pre-configured GitHub Actions pipelines for automated builds and deployments to Azure App Service. The template supports two deployment methods out of the box: Docker and Zip deployment, with built-in support for both development and production environments.

The deployment pipeline automatically determines the target environment based on the branch:

  • Main branch: Deploys to production environment
  • Other branches: Deploy to development environment

This environment-based deployment strategy enables continuous integration and deployment (CI/CD) while maintaining separation between development and production workloads.

These pipelines have been developed to suit my personal workflow and can serve as a starting point for your own setup. If you're using this template in a team environment or working with multiple deployment environments (e.g., dev, staging, production), you'll likely need to update the pipeline scripts to align with your team's structure and deployment strategy.
GitHub Actions Pipeline

When you host your code on GitHub, the deployment pipeline is automatically made available through:

\.github\workflows\
  • 📄 docker-build-deploy.yml.disabled
  • 📄 zip-build-deploy.yml

The docker-build-deploy.yml.disabled ends with disabed extension as its disabled by default. You can rename it to docker-build-deploy.yml to enable it. Deploying using the docker method will require you to setup an azure docker registry and configure the app service to use docker as the publishing method. You should only have 1 of the 2 workflows enabled. Choose the deployment type you wish to use and disable or delete the one you are not using.

Prerequisites
  • Follow the instructions from Authenticate to Azure from GitHub to create the credentials required for the AZURE_CREDENTIALS Github Secret setup.
  • Go to your GitHub repository settings
  • Navigate to "Environments" section
  • Create two environments:
    • prod - Production environment
    • dev - Development environment
  • Setup 2 Azure App Service instances, one for dev and the other for prod
  • Review and Update the Github Actions workflow accordingly
  • Setup the following secrets in the 2 enviroments below depending on the Deployment type you choose
    Zip Deployment Secrets
    Secret Name Description Required
    AZURE_CREDENTIALS The credentials required to login to azure to deploy the code to the app service Yes
    Docker Deployment Secrets
    Secret Name Description Required
    DOCKER_REGISTRY_SERVER_USERNAME Azure Container Registry Username Yes
    DOCKER_REGISTRY_SERVER_PASSWORD Azure Container Registry Password Yes
    AZURE_CREDENTIALS The credentials required to login to azure to deploy the code to the app service Yes
    The Docker Registry Server Username and Password can be obtained from the container registry under the Access keys tab:
    Azure Container Registry
    Here's an Example of the GitHub Enviroment Secret setup:
    GitHub Secrets