generated from ministryofjustice/hmpps-template-kotlin
-
Notifications
You must be signed in to change notification settings - Fork 0
111 lines (104 loc) · 3.15 KB
/
pipeline.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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: Pipeline [test -> build -> deploy]
on:
push:
branches:
- '**'
workflow_dispatch:
inputs:
environment:
description: Environment
type: choice
required: true
options:
- dev
- preprod
- staging
- production
default: 'dev'
docker_registry:
description: Docker registry
required: true
default: 'ghcr.io'
type: choice
options:
- 'ghcr.io'
- 'quay.io'
registry_org:
description: Docker registry organisation
required: true
default: 'ministryofjustice'
type: choice
options:
- 'ministryofjustice'
- 'hmpps'
additional_docker_tag:
description: Additional docker tag that can be used to specify stable tags
required: false
default: ''
type: string
push:
description: Push docker image to registry flag
required: true
default: true
type: boolean
docker_multiplatform:
description: docker multiplatform build or not
required: true
default: true
type: boolean
permissions:
contents: read
packages: write
jobs:
helm_lint:
name: helm lint
uses: ministryofjustice/hmpps-github-actions/.github/workflows/test_helm_lint.yml@v2 # WORKFLOW VERSION
secrets: inherit
with:
environment: ${{ inputs.environment || 'dev' }}
kotlin_validate:
name: Validate the kotlin
uses: ministryofjustice/hmpps-github-actions/.github/workflows/kotlin_validate.yml@v2 # WORKFLOW_VERSION
secrets: inherit
build:
name: Build docker image from hmpps-github-actions
if: github.ref == 'refs/heads/main'
uses: ministryofjustice/hmpps-github-actions/.github/workflows/docker_build.yml@v2 # WORKFLOW_VERSION
needs:
- kotlin_validate
with:
docker_registry: ${{ inputs.docker_registry || 'ghcr.io' }}
registry_org: ${{ inputs.registry_org || 'ministryofjustice' }}
additional_docker_tag: ${{ inputs.additional_docker_tag }}
push: ${{ inputs.push || true }}
docker_multiplatform: ${{ inputs.docker_multiplatform || true }}
deploy_dev:
name: Deploy to dev environment
needs:
- build
- helm_lint
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION
secrets: inherit
with:
environment: 'development'
app_version: '${{ needs.build.outputs.app_version }}'
deploy_preprod:
name: Deploy to pre-production environment
needs:
- build
- deploy_dev
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION
secrets: inherit
with:
environment: 'preprod'
app_version: '${{ needs.build.outputs.app_version }}'
deploy_production:
name: Deploy to production environment
needs:
- build
- deploy_preprod
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION
secrets: inherit
with:
environment: 'production'
app_version: '${{ needs.build.outputs.app_version }}'