DR-1125 Remove child-process.execSync() #163
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: Pipeline Deployment Application | |
on: | |
push: | |
branches: | |
- main | |
- 'task/*' | |
pull_request: | |
types: | |
- labeled | |
workflow_dispatch: | |
inputs: | |
tag: | |
description: "Specify the tag to be used for deployment" | |
required: true | |
type: string | |
environment: | |
description: 'Deployment environment' | |
required: true | |
default: 'dev' | |
type: choice | |
options: | |
- dev | |
- test | |
- int | |
jobs: | |
metadata: | |
name: "Get Metadata" | |
uses: NHSDigital/uec-dos-management/.github/workflows/metadata.yaml@latest | |
generate-tag-name: | |
name: "Generate Tag Name" | |
needs: | |
[ | |
metadata, | |
] | |
if: ${{ (needs.metadata.outputs.environment == 'test' || needs.metadata.outputs.environment == 'int') && github.event.action == 'labeled' }} | |
uses: NHSDigital/uec-dos-management/.github/workflows/generate-tag-name.yaml@latest | |
with: | |
workspace: ${{ needs.metadata.outputs.workspace }} | |
tag_type: ${{ needs.metadata.outputs.environment }} | |
use_commit_hash: "yes" | |
commit_hash: ${{ needs.metadata.outputs.artefact_commit_hash }} | |
tag-repository: | |
name: "Tag Repository" | |
needs: | |
[ | |
metadata, | |
generate-tag-name, | |
] | |
if: ${{ needs.metadata.outputs.environment == 'test' || needs.metadata.outputs.environment == 'int' }} && ${{ github.event.action == 'labeled' }} | |
uses: NHSDigital/uec-dos-management/.github/workflows/tag-repository.yaml@latest | |
with: | |
tag_to_push: ${{ needs.generate-tag-name.outputs.tag_name }} | |
tag_overwrite: "yes" | |
quality-check: | |
name: "Quality Check" | |
needs: | |
[ | |
metadata, | |
] | |
if: ${{ needs.metadata.outputs.environment == 'dev' }} | |
uses: NHSDigital/uec-dos-management/.github/workflows/quality-checks.yaml@latest | |
with: | |
environment: ${{ needs.metadata.outputs.environment }} | |
workspace: ${{ needs.metadata.outputs.workspace }} | |
stacks: '["github-runner", "terraform_management", "application", "ui-test"]' | |
secrets: inherit | |
build-and-push-react-artefacts: | |
name: "Build React Application and Push Artefact to S3 Bucket" | |
needs: [ | |
metadata, | |
quality-check, | |
] | |
if: ${{ needs.metadata.outputs.environment == 'dev' }} | |
uses: NHSDigital/uec-dos-management/.github/workflows/build-react-app.yaml@latest | |
with: | |
environment: ${{ needs.metadata.outputs.environment }} | |
workspace: ${{ needs.metadata.outputs.workspace }} | |
domain: ${{ needs.metadata.outputs.reponame }} | |
commit_hash: ${{ needs.metadata.outputs.commit_hash }} | |
artefact_bucket_name: ${{ needs.metadata.outputs.artefact_bucket_name }} | |
permissions: | |
id-token: write | |
contents: read | |
secrets: inherit | |
deploy-application-infrastructure: | |
name: "Deploy Application Infrastructure to ${{ needs.metadata.outputs.environment }} Environment" | |
needs: | |
[ | |
metadata, | |
generate-tag-name, | |
build-and-push-react-artefacts, | |
] | |
if: always() && !cancelled() && (needs.build-and-push-react-artefacts.result == 'success' || needs.build-and-push-react-artefacts.result == 'skipped') | |
uses: NHSDigital/uec-dos-management/.github/workflows/deploy-infrastructure.yaml@latest | |
with: | |
environment: ${{ needs.metadata.outputs.environment }} | |
workspace: ${{ needs.metadata.outputs.workspace }} | |
domain: ${{ needs.metadata.outputs.reponame }} | |
project: ${{ vars.PROJECT }} | |
stacks: '["application", "ui-test"]' | |
tag: ${{ needs.generate-tag-name.outputs.tag_name != '' && needs.generate-tag-name.outputs.tag_name || inputs.tag }} | |
action: apply | |
workflow_timeout: 10 | |
secrets: inherit | |
deploy-react-app: | |
name: "Deploy React Application to ${{ needs.metadata.outputs.environment }} Environment" | |
needs: [ | |
metadata, | |
generate-tag-name, | |
build-and-push-react-artefacts, | |
deploy-application-infrastructure, | |
] | |
if: always() && !cancelled() && (needs.build-and-push-react-artefacts.result == 'success' || needs.build-and-push-react-artefacts.result == 'skipped') | |
uses: NHSDigital/uec-dos-management/.github/workflows/deploy-react-app.yaml@latest | |
with: | |
environment: ${{ needs.metadata.outputs.environment }} | |
workspace: ${{ needs.metadata.outputs.workspace }} | |
domain: ${{ needs.metadata.outputs.reponame }} | |
artefact_sub_dir: ${{ needs.metadata.outputs.workspace }} | |
commit_hash: ${{ needs.metadata.outputs.artefact_commit_hash != '' && needs.metadata.outputs.artefact_commit_hash || needs.metadata.outputs.commit_hash }} | |
artefact_bucket_name: ${{ needs.metadata.outputs.artefact_bucket_name }} | |
tag: ${{ needs.generate-tag-name.outputs.tag_name != '' && needs.generate-tag-name.outputs.tag_name || inputs.tag }} | |
permissions: | |
id-token: write | |
contents: read | |
secrets: inherit | |
ui-test: | |
name: "Run UI Tests on ${{ needs.metadata.outputs.environment }} Environment" | |
needs: | |
[ | |
metadata, | |
generate-tag-name, | |
deploy-application-infrastructure, | |
deploy-react-app, | |
] | |
if: always() && !cancelled() && (needs.metadata.outputs.environment == 'test') | |
uses: NHSDigital/uec-dos-management/.github/workflows/ui-test.yaml@latest | |
with: | |
environment: ${{ needs.metadata.outputs.environment }} | |
workspace: ${{ needs.metadata.outputs.workspace != '' && needs.metadata.outputs.workspace || inputs.workspace }} | |
tag: ${{ needs.generate-tag-name.outputs.tag_name != '' && needs.generate-tag-name.outputs.tag_name || inputs.tag }} | |
secrets: inherit | |
slack-notifications: | |
name: "Send Notification to Slack" | |
needs: [ | |
metadata, | |
quality-check, | |
generate-tag-name, | |
tag-repository, | |
build-and-push-react-artefacts, | |
deploy-application-infrastructure, | |
deploy-react-app, | |
ui-test, | |
] | |
if: always() | |
uses: NHSDigital/uec-dos-management/.github/workflows/slack-notifications.yaml@latest | |
with: | |
env: ${{ needs.metadata.outputs.environment }} | |
secrets: inherit |