-
Notifications
You must be signed in to change notification settings - Fork 6
113 lines (99 loc) · 4.5 KB
/
Copy pathdeploy.production.yml
File metadata and controls
113 lines (99 loc) · 4.5 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
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
# Deploy to Production (carrot.ac.uk)
#
# This workflow deploys Docker images to the production environment.
# It requires manual approval and validates image existence before deployment.
#
# When to use:
# - Deploying stable releases to production
# - Deploying edge images to production after testing (I don't recommend this though)
# - Emergency deployments with specific image tags
#
# What it does:
# - Validates that the specified image tag exists
# - Deploys all services to production environment
# - Requires manual approval (environment protection)
# - Provides deployment summary
name: Deploy to Production (carrot.ac.uk)
on:
workflow_dispatch:
inputs:
image_tag:
description: 'Image tag to deploy (e.g., v4.0.1, v4.1.0, or specific commit SHA)'
required: true
env:
app-name: carrot
repo-owner: health-informatics-uon
registry: ghcr.io
permissions:
contents: read
jobs:
validate-deployment:
runs-on: ubuntu-latest
steps:
- name: Validate image tag
run: |
if [[ "${{ github.event.inputs.image_tag }}" == "" ]]; then
echo "❌ Image tag is required"
exit 1
fi
echo "✅ Deploying image tag: ${{ github.event.inputs.image_tag }}"
deploy-to-production:
runs-on: ubuntu-latest
environment: production
needs: [validate-deployment]
steps:
# Check that images exist before deploying
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/backend
tag: ${{ github.event.inputs.image_tag }}
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/frontend
tag: ${{ github.event.inputs.image_tag }}
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver
tag: ${{ github.event.inputs.image_tag }}
- uses: tyriis/docker-image-tag-exists@71a750a41aa78e4efb0842f538140c5df5b8166f # v2.1.0
with:
registry: ${{ env.registry }}
repository: ${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler
tag: ${{ github.event.inputs.image_tag }}
- name: Deploy Backend to Production
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AZURE_WEBAPP_NAME }}
slot-name: "production"
publish-profile: ${{ secrets.AZURE_WEBAPP_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/backend:${{ github.event.inputs.image_tag }}
- name: Deploy Frontend to Production
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AZURE_WEBAPP_NEXT_NAME }}
slot-name: "production"
publish-profile: ${{ secrets.AZURE_WEBAPP_NEXT_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/frontend:${{ github.event.inputs.image_tag }}
- name: Deploy Airflow Webserver to Production
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AIRFLOW_WEBSERVER_NAME }}
slot-name: "production"
publish-profile: ${{ secrets.AIRFLOW_WEBSERVER_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-webserver:${{ github.event.inputs.image_tag }}
- name: Deploy Airflow Scheduler to Production
uses: azure/webapps-deploy@2fdd5c3ebb4e540834e86ecc1f6fdcd5539023ee # v3.0.2
with:
app-name: ${{ vars.AIRFLOW_SCHEDULER_NAME }}
slot-name: "production"
publish-profile: ${{ secrets.AIRFLOW_SCHEDULER_PUBLISH_PROFILE }}
images: ${{ env.registry }}/${{ env.repo-owner }}/${{ env.app-name }}/airflow-scheduler:${{ github.event.inputs.image_tag }}
- name: Deployment Summary
run: |
echo "✅ Successfully deployed to production (carrot.ac.uk)"
echo "📦 Image tag: ${{ github.event.inputs.image_tag }}"
echo "🔗 Production URL: https://carrot.ac.uk"
echo "📅 Deployment time: $(date -u)"