Proof of concept to demonstrate a simple CI-CD deployment pipeline to deploy an Angular web application to 3x Azure Static Web App environments (i.e. development, test and production).
*** This project is still a work in progress ***
Name | URL |
---|---|
Development | https://salmon-glacier-07a38f700.1.azurestaticapps.net/ |
Test / UAT | https://zealous-pebble-0ac38c600.1.azurestaticapps.net/ |
Production | https://nice-river-0eaf48d00.1.azurestaticapps.net/ |
Utilises a simple branching model involving:
develop
- Contains active development that has not yet been released to the production environment.main
- Contains code already / to be deployed to the production environment.
Workflow | Trigger | Action Performed |
---|---|---|
.github\workflows\deploy-dev.yml |
On Push to the 'develop ' branch |
Builds code, runs tests and then deploys to the Development environment |
.github\workflows\deploy-test.yml |
Manually triggered | Builds code, runs tests and then deploys to the Test environment Note: workflow will only execute against the develop branch |
.github\workflows\deploy-prod.yml |
Manually triggered | Builds code, runs tests and then deploys to the Production environment. Note: workflow will only execute against the main branch |
-
Create following 'GitHub Environments' via the Project Settings page.
- development
- test
- production
-
Run the below command in the Azure Portal Cloud Shell to create the Azure app registration used for github actions deployment
az ad sp create-for-rbac --name GatedDeploymentPocGithubActions --role contributor --scopes /subscriptions/XXXXX-XXXXX-XXXXX-XXXXX-XXXXX/resourceGroups/gated-deployment-poc --sdk-auth
-
Create Github project secret '
AZURE_CREDENTIALS
' for each GitHub Environment. This should be set to the JSON string returned by the command from the previous step. -
Create Github project secret '
AZURE_RESOURCE_GROUP_NAME
' for each GitHub Environment. This should be set to the name of the Resource Group containing the Azure Static Web App Resource e.g. gated-deployment-poc. The Resource Group needs to be pre-created before running the deployment workflow. -
Create Github project secret '
AZURE_STATIC_WEB_DEPLOY_KEY
' for each GitHub Environment containing the Static Web App Deployment Key. The Static Web App should be created in the above mentioned Resource Group before running the deployment workflow.