-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (101 loc) · 4.46 KB
/
deploy.yml
File metadata and controls
116 lines (101 loc) · 4.46 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
114
115
116
name: Deploy to environment
# Manual deployment only - user must select application and environment
on:
workflow_dispatch:
inputs:
application:
type: choice
description: "Choose an application to deploy"
required: true
options:
- Transfers
- Lsrp
- RGVisits
environment:
type: choice
description: "Choose an environment to deploy to"
required: true
options:
- development
- test
- production
concurrency:
group: ${{ github.workflow }}-${{ github.event.inputs.application }}-${{ github.event.inputs.environment }}-${{ github.run_number }}
jobs:
set-env:
name: Preflight
runs-on: ubuntu-24.04
outputs:
application: ${{ steps.var.outputs.application }}
environment: ${{ steps.var.outputs.environment }}
branch: ${{ steps.var.outputs.branch }}
checked-out-sha: ${{ steps.var.outputs.checked-out-sha }}
image-name: ${{ steps.var.outputs.image-name }}
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- id: var
run: |
GIT_REF=${{ github.ref_name }}
GIT_BRANCH=${GIT_REF##*/}
# Get application and environment from workflow inputs (required)
APPLICATION="${{ github.event.inputs.application }}"
ENVIRONMENT="${{ github.event.inputs.environment }}"
# Construct GitHub Environment name: transfers-development, lsrp-production, etc.
GITHUB_ENVIRONMENT="${APPLICATION,,}-${ENVIRONMENT,,}"
# Construct image name: extapp-transfers, extapp-lsrp, etc.
IMAGE_NAME="extapp-${APPLICATION,,}"
CHECKED_OUT_SHA="$(git log -1 '--format=format:%H')"
echo "application=${APPLICATION}" >> $GITHUB_OUTPUT
echo "environment=${GITHUB_ENVIRONMENT}" >> $GITHUB_OUTPUT
echo "branch=$GIT_BRANCH" >> $GITHUB_OUTPUT
echo "checked-out-sha=${CHECKED_OUT_SHA}" >> $GITHUB_OUTPUT
echo "image-name=${IMAGE_NAME}" >> $GITHUB_OUTPUT
build-import-deploy:
name: Deploy ${{ needs.set-env.outputs.application }} to ${{ needs.set-env.outputs.environment }}
runs-on: ubuntu-24.04
needs: [ set-env ]
environment: ${{ needs.set-env.outputs.environment }}
permissions:
attestations: write
packages: write
id-token: write
steps:
- name: Checkout
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Build
uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/build@8e72e403f05ff9da09668207eef1d79e1ce9d1a7 # v5.2.1
with:
image-name: ${{ needs.set-env.outputs.image-name }}
build-args: |
CI=true
APPLICATION=${{ needs.set-env.outputs.application }}
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Import
uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/import@8e72e403f05ff9da09668207eef1d79e1ce9d1a7 # v5.2.1
with:
image-name: ${{ needs.set-env.outputs.image-name }}
azure-acr-name: ${{ secrets.ACR_NAME }}
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-acr-client-id: ${{ secrets.ACR_CLIENT_ID }}
github-token: ${{ secrets.GITHUB_TOKEN }}
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID || '' }}
AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION_ID || '' }}
AZURE_ACR_CLIENT_ID: ${{ secrets.ACR_CLIENT_ID || '' }}
- name: Release
uses: DFE-Digital/deploy-azure-container-apps-action/.github/actions/deploy@8e72e403f05ff9da09668207eef1d79e1ce9d1a7 # v5.2.1
with:
image-name: ${{ needs.set-env.outputs.image-name }}
annotate-release: 'yes'
azure-tenant-id: ${{ secrets.AZURE_TENANT_ID }}
azure-subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
azure-acr-name: ${{ secrets.ACR_NAME }}
azure-aca-client-id: ${{ secrets.ACA_CLIENT_ID }}
azure-aca-name: ${{ secrets.ACA_NAME }}
azure-aca-resource-group: ${{ secrets.ACA_RESOURCE_GROUP }}
env:
AZURE_TENANT_ID: ${{ secrets.AZURE_TENANT_ID || '' }}
AZURE_SUBSCRIPTION: ${{ secrets.AZURE_SUBSCRIPTION_ID || '' }}
AZURE_ACA_CLIENT_ID: ${{ secrets.ACA_CLIENT_ID || '' }}