|
| 1 | +name: Pipeline [test -> build -> deploy] |
| 2 | +on: |
| 3 | + push: |
| 4 | + branches: |
| 5 | + - '**' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + additional_docker_tag: |
| 9 | + description: Additional docker tag that can be used to specify stable or testing tags |
| 10 | + required: false |
| 11 | + default: '' |
| 12 | + type: string |
| 13 | + push: |
| 14 | + description: Push docker image to registry flag |
| 15 | + required: true |
| 16 | + default: false |
| 17 | + type: boolean |
| 18 | +permissions: |
| 19 | + contents: read |
| 20 | + packages: write |
| 21 | +concurrency: |
| 22 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 23 | + cancel-in-progress: ${{ github.ref != 'refs/heads/main' }} |
| 24 | +jobs: |
| 25 | + helm_lint: |
| 26 | + strategy: |
| 27 | + matrix: |
| 28 | + environments: ['dev', 'preprod', 'prod'] |
| 29 | + name: helm lint |
| 30 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/test_helm_lint.yml@v2 # WORKFLOW VERSION |
| 31 | + secrets: inherit |
| 32 | + with: |
| 33 | + environment: ${{ matrix.environments }} |
| 34 | + kotlin_validate: |
| 35 | + name: Validate the kotlin |
| 36 | + uses: ./.github/workflows/kotlin_integration_tests.yml |
| 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: "" |
| 51 | + deploy_dev: |
| 52 | + name: Deploy to the dev environment |
| 53 | + if: github.ref == 'refs/heads/main' |
| 54 | + needs: |
| 55 | + - build |
| 56 | + - helm_lint |
| 57 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION |
| 58 | + secrets: inherit |
| 59 | + with: |
| 60 | + environment: 'dev' |
| 61 | + app_version: '${{ needs.build.outputs.app_version }}' |
| 62 | + deploy_preprod: |
| 63 | + name: Deploy to the preprod environment |
| 64 | + needs: |
| 65 | + - build |
| 66 | + - helm_lint |
| 67 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION |
| 68 | + secrets: inherit |
| 69 | + with: |
| 70 | + environment: 'preprod' |
| 71 | + app_version: '${{ needs.build.outputs.app_version }}' |
| 72 | + deploy_prod: |
| 73 | + name: Deploy to the prod environment |
| 74 | + needs: |
| 75 | + - build |
| 76 | + - helm_lint |
| 77 | + - deploy_dev |
| 78 | + - deploy_preprod |
| 79 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION |
| 80 | + secrets: inherit |
| 81 | + with: |
| 82 | + environment: 'prod' |
| 83 | + app_version: '${{ needs.build.outputs.app_version }}' |
0 commit comments