-
Notifications
You must be signed in to change notification settings - Fork 0
97 lines (88 loc) · 3.47 KB
/
deploy_env.yml
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
name: Build & push docker image and deploy to environment
on:
workflow_call:
inputs:
environment:
description: Environment
required: true
type: string
app_version:
description: App version
required: true
type: string
k8s_deployment_name:
description: Kubernetes deployment name
default: "PROJECT_NAME"
required: false
type: string
changelog_git_paths:
description: Changelog git paths
required: false
default: ""
type: string
show_changelog:
description: Show changelog
default: true
required: false
type: boolean
permissions:
contents: read
jobs:
deploy_env:
name: Deploy to ${{ inputs.environment }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
environment: ${{ inputs.environment }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: azure/setup-kubectl@v4
id: install
with:
version: latest
- name: Set Slack Channel ID
id: set-slack-channel-id
run: |
if [[ "${{ inputs.environment }}" == "prod" ]]; then
echo "slack_channel_id=${{ vars.PROD_RELEASES_SLACK_CHANNEL }}" | tee -a $GITHUB_OUTPUT
else
echo "slack_channel_id=${{ vars.NONPROD_RELEASES_SLACK_CHANNEL }}" | tee -a $GITHUB_OUTPUT
fi
- uses: ministryofjustice/hmpps-github-actions/.github/actions/build-test-and-deploy/cloud-platform-deploy@v2 # WORKFLOW_VERSION
id: deploy
with:
environment: ${{ inputs.environment }}
version: ${{ inputs.app_version }}
api: https://${{ secrets.KUBE_CLUSTER }}
cert: ${{ secrets.KUBE_CERT }}
cluster: ${{ secrets.KUBE_CLUSTER }}
namespace: ${{ secrets.KUBE_NAMESPACE }}
token: ${{ secrets.KUBE_TOKEN }}
k8s_deployment_name: ${{ inputs.k8s_deployment_name }}
changelog_git_paths: ${{ inputs.changelog_git_paths }}
show_changelog: ${{ inputs.show_changelog }}
continue-on-error: true
# Notification bit - always send prod releases to dps-releases - CVA3MKDTR
- if: ${{ inputs.environment == 'prod' || inputs.environment == 'production' }}
id: prod-dps-slack
uses: ministryofjustice/hmpps-github-actions/.github/actions/slack_release_results@v2 # WORKFLOW_VERSION
with:
channel_id: 'CVA3MKDTR'
environment: ${{ inputs.environment }}
app_version: ${{ inputs.app_version }}
deploy_outcome: ${{ steps.deploy.outcome }}
slack_bot_token: ${{ secrets.HMPPS_SRE_SLACK_BOT_TOKEN }}
deployment_changelog: ${{ steps.deploy.outputs.deployment_changelog }}
# Optional prod releases slack channel (using PROD_RELEASES_SLACK_CHANNEL variable)
- if: ${{ steps.set-slack-channel-id.outputs.slack_channel_id != '' }}
id: send-release-slack
uses: ministryofjustice/hmpps-github-actions/.github/actions/slack_release_results@v2 # WORKFLOW_VERSION
with:
channel_id: ${{ steps.set-slack-channel-id.outputs.slack_channel_id }}
environment: ${{ inputs.environment }}
app_version: ${{ inputs.app_version }}
deploy_outcome: ${{ steps.deploy.outcome }}
slack_bot_token: ${{ secrets.HMPPS_SRE_SLACK_BOT_TOKEN }}
deployment_changelog: ${{ steps.deploy.outputs.deployment_changelog }}