forked from benc-uk/python-demoapp
-
Notifications
You must be signed in to change notification settings - Fork 0
77 lines (64 loc) · 2.13 KB
/
Copy pathcd-release-webapp.yaml
File metadata and controls
77 lines (64 loc) · 2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
#
# Deploy to Azure App Service as a containerized Web App
# Using Bicep for infrastructure as code
#
name: CD Release - Webapp
on:
workflow_dispatch:
inputs:
IMAGE_TAG:
description: 'Image tag to be deployed'
required: true
default: 'latest'
# Note. Required secrets: AZURE_CREDENTIALS
env:
IMAGE_REG: ghcr.io
IMAGE_REPO: benc-uk/python-demoapp
APP_NAME: python-demoapp
ARM_SUB_ID: 52512f28-c6ed-403e-9569-82a9fb9fec91
ARM_REGION: westeurope
ARM_RES_GROUP: apps
DOTNET_SYSTEM_GLOBALIZATION_INVARIANT: 1 # Fixes weird Azure CLI + Bicep + GHA bug
jobs:
#
# Deploy Azure infra (App Service) using Bicep
#
deploy-infra:
environment:
name: App Service - python-demoapp
url: https://${{ env.APP_NAME }}.azurewebsites.net/
name: 'Deploy Infra'
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2
- name: 'Login to Azure'
uses: azure/login@v1.3.0
with:
creds: ${{ secrets.AZURE_CREDENTIALS }}
- name: 'Create resource group'
run: az group create --name $ARM_RES_GROUP --location $ARM_REGION
- name: 'Deploy resources'
run: |
az deployment group create --template-file deploy/webapp.bicep -g $ARM_RES_GROUP -p webappName=$APP_NAME \
webappImage=$IMAGE_REG/$IMAGE_REPO:${{ github.event.inputs.IMAGE_TAG }} \
releaseInfo="Ref=${{ github.ref }} RunId=${{ github.run_id }}"
#
# Post deployment testing stage
#
validate-deployment:
name: 'Run Deployment Tests'
needs: deploy-infra
environment:
name: App Service - python-demoapp
url: https://${{ env.APP_NAME }}.azurewebsites.net/
runs-on: ubuntu-latest
steps:
- name: 'Checkout'
uses: actions/checkout@v2
- name: 'Validate site is running'
run: .github/scripts/url-check.sh -u https://${APP_NAME}.azurewebsites.net/ -s "Flask" -t 200
- name: 'Run API tests'
run: |
npm install newman --silent
node_modules/newman/bin/newman.js run tests/postman_collection.json --global-var apphost=${APP_NAME}.azurewebsites.net