|
| 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 | + node_build: |
| 26 | + name: node build |
| 27 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_build.yml@v2 # WORKFLOW_VERSION |
| 28 | + secrets: inherit |
| 29 | + node_unit_tests: |
| 30 | + name: node unit tests |
| 31 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_unit_tests.yml@v2 # WORKFLOW_VERSION |
| 32 | + needs: [node_build] |
| 33 | + secrets: inherit |
| 34 | + node_integration_tests: |
| 35 | + name: node integration tests |
| 36 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_integration_tests.yml@v2 # WORKFLOW_VERSION |
| 37 | + needs: [node_build] |
| 38 | + secrets: inherit |
| 39 | + helm_lint: |
| 40 | + strategy: |
| 41 | + matrix: |
| 42 | + environments: ['dev', 'preprod', 'prod'] |
| 43 | + name: helm lint |
| 44 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/test_helm_lint.yml@v2 # WORKFLOW_VERSION |
| 45 | + secrets: inherit |
| 46 | + with: |
| 47 | + environment: ${{ matrix.environments }} |
| 48 | + build: |
| 49 | + name: Build docker image from hmpps-github-actions |
| 50 | + if: github.ref == 'refs/heads/main' |
| 51 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/docker_build.yml@v2 # WORKFLOW_VERSION |
| 52 | + needs: |
| 53 | + - node_integration_tests |
| 54 | + - node_unit_tests |
| 55 | + with: |
| 56 | + docker_registry: 'ghcr.io' |
| 57 | + registry_org: 'ministryofjustice' |
| 58 | + additional_docker_tag: ${{ inputs.additional_docker_tag }} |
| 59 | + push: ${{ inputs.push || true }} |
| 60 | + docker_multiplatform: true |
| 61 | + deploy_dev: |
| 62 | + name: Deploy to the dev environment |
| 63 | + if: github.ref == 'refs/heads/main' |
| 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: 'dev' |
| 71 | + app_version: '${{ needs.build.outputs.app_version }}' |
| 72 | + helm_timeout: '5m' |
| 73 | + deploy_preprod: |
| 74 | + name: Deploy to the preprod environment |
| 75 | + if: github.ref == 'refs/heads/main' |
| 76 | + needs: |
| 77 | + - build |
| 78 | + - helm_lint |
| 79 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION |
| 80 | + secrets: inherit |
| 81 | + with: |
| 82 | + environment: 'preprod' |
| 83 | + app_version: '${{ needs.build.outputs.app_version }}' |
| 84 | + helm_timeout: '5m' |
| 85 | + deploy_prod: |
| 86 | + name: Deploy to the preprod environment |
| 87 | + if: github.ref == 'refs/heads/main' |
| 88 | + needs: |
| 89 | + - build |
| 90 | + - helm_lint |
| 91 | + - deploy_dev |
| 92 | + - deploy_preprod |
| 93 | + uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@v2 # WORKFLOW_VERSION |
| 94 | + secrets: inherit |
| 95 | + with: |
| 96 | + environment: 'prod' |
| 97 | + app_version: '${{ needs.build.outputs.app_version }}' |
| 98 | + helm_timeout: '5m' |
0 commit comments