try create_app_version - attempt 1 #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Test - Build - Deploy Pipeline | |
on: | |
push: | |
branches: | |
- main | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: Environment | |
type: choice | |
required: true | |
options: | |
- dev | |
- prod | |
- staging | |
default: 'dev' | |
version: # Only used when run manually - build.yml will include it | |
description: Image version | |
type: string | |
required: true | |
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 | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
node_build: | |
name: node build | |
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_build.yml@main | |
secrets: inherit | |
node_unit_tests: | |
name: node unit tests | |
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_unit_tests.yml@main | |
needs: [node_build] | |
secrets: inherit | |
node_integration_tests: | |
name: node integration tests | |
uses: ministryofjustice/hmpps-github-actions/.github/workflows/node_integration_tests.yml@main | |
needs: [node_build] | |
secrets: inherit | |
helm_lint: | |
name: helm lint | |
uses: ministryofjustice/hmpps-github-actions/.github/workflows/test_helm_lint.yml@main | |
secrets: inherit | |
with: | |
environment: ${{ inputs.environment || 'development' }} | |
build: | |
name: Build docker image from hmpps-github-actions | |
uses: ministryofjustice/hmpps-github-actions/.github/workflows/docker_build.yml@move_create_app_version_in_action | |
needs: | |
- helm_lint | |
- node_integration_tests | |
- node_unit_tests | |
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 || false }} | |
dev-approval-gate: | |
needs: [node_unit_tests,node_integration_tests,helm_lint] | |
environment: 'development' | |
runs-on: ubuntu-latest | |
steps: | |
- name: approve | |
env: | |
ENV_NAME: ${{ inputs.environment || 'development' }} | |
run: echo "Approve for ${ENV_NAME}" | |
deploy_dev: | |
name: Deploy | |
needs: | |
- dev-approval-gate | |
- build | |
uses: ministryofjustice/hmpps-github-actions/.github/workflows/deploy_env.yml@main | |
secrets: inherit | |
with: | |
environment: 'dev' | |
app_version: '${{ needs.build.outputs.app_version }}' | |