Commit 7f02eb1 1 parent 61ba489 commit 7f02eb1 Copy full SHA for 7f02eb1
File tree 2 files changed +59
-16
lines changed
2 files changed +59
-16
lines changed Original file line number Diff line number Diff line change
1
+ name : Build & push docker image and deploy to environment
2
+
3
+ on :
4
+ workflow_call :
5
+
6
+ outputs :
7
+ app_version :
8
+ description : The version of the app as generated by create_app_version
9
+ value : ${{ jobs.docker_build.outputs.version }}
10
+
11
+ permissions :
12
+ contents : read
13
+ packages : write
14
+
15
+ jobs :
16
+ docker_build :
17
+ name : Build docker image
18
+ runs-on : ubuntu-latest
19
+ outputs :
20
+ version : ${{ steps.app_version.outputs.version }}
21
+ steps :
22
+ - id : app_version
23
+ name : Application version creators
24
+ uses : ministryofjustice/hmpps-github-actions/.github/actions/build-test-and-deploy/create_app_version@v2 # WORKFLOW_VERSION
25
+
26
+ - uses : actions/checkout@v4
27
+ - name : refresh cache
28
+ id : initial-cache
29
+ uses : actions/cache@v4
30
+ env :
31
+ cache-name : kotlin-cache
32
+ with :
33
+ path : |
34
+ - gradle-{{ checksum "build.gradle.kts" }}
35
+ - gradle-
36
+ key : ${{ runner.os }}-gradle-${{ env.cache-name }}-${{ hashFiles('build.gradle.kts') }}
37
+
38
+ - uses : actions/setup-java@v4
39
+ with :
40
+ distribution : ' temurin'
41
+ java-version : ' 21'
42
+ cache : ' gradle'
43
+ cache-dependency-path : |
44
+ *.gradle*
45
+ **/gradle-wrapper.properties
46
+ - run : ./gradlew jib --image="${IMAGE_NAME}:${BUILD_NUMBER}" -Djib.to.auth.username=${GITHUB_USERNAME} -Djib.to.auth.password=${GITHUB_PASSWORD} -Djib.to.tags=latest -Djib.container.environment=BUILD_NUMBER="${BUILD_NUMBER}"
47
+ env :
48
+ GITHUB_USERNAME : ${{ github.actor }}
49
+ GITHUB_PASSWORD : ${{ github.token }}
50
+ BUILD_NUMBER : ${{ steps.app_version.outputs.version }}
51
+ IMAGE_NAME : " ghcr.io/ministryofjustice/probation-offender-search"
Original file line number Diff line number Diff line change @@ -35,24 +35,16 @@ jobs:
35
35
name : Validate the kotlin
36
36
uses : ./.github/workflows/kotlin_integration_tests.yml
37
37
secrets : inherit
38
- build :
39
- name : Build docker image from hmpps-github-actions
40
- if : github.ref == 'refs/heads/main'
41
- uses : ministryofjustice/hmpps-github-actions/.github/workflows/docker_build.yml@v2 # WORKFLOW_VERSION
42
- needs :
43
- - kotlin_validate
44
- with :
45
- docker_registry : ' ghcr.io'
46
- registry_org : ' ministryofjustice'
47
- additional_docker_tag : " "
48
- push : ${{ inputs.push || true }}
49
- docker_multiplatform : false
50
- additional_docker_build_args : " "
38
+ docker_build :
39
+ if : ${{ github.ref == 'refs/heads/main' || inputs.push }}
40
+ name : Push image
41
+ uses : ./.github/workflows/jib-build.yml
42
+ needs : kotlin_validate
51
43
deploy_dev :
52
44
name : Deploy to the dev environment
53
45
if : github.ref == 'refs/heads/main'
54
46
needs :
55
- - build
47
+ - docker_build
56
48
- helm_lint
57
49
uses : ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION
58
50
secrets : inherit
62
54
deploy_preprod :
63
55
name : Deploy to the preprod environment
64
56
needs :
65
- - build
57
+ - docker_build
66
58
- helm_lint
67
59
uses : ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION
68
60
secrets : inherit
72
64
deploy_prod :
73
65
name : Deploy to the prod environment
74
66
needs :
75
- - build
67
+ - docker_build
76
68
- helm_lint
77
69
- deploy_dev
78
70
- deploy_preprod
You can’t perform that action at this time.
0 commit comments