Skip to content

deploy to environments #53

deploy to environments

deploy to environments #53

Workflow file for this run

name: deploy to environments
on:
workflow_dispatch:
env:
BRANCH_NAME: ${{ github.event.ref.BRANCH_NAME }}
jobs:
get_asdf_version:
runs-on: ubuntu-22.04
outputs:
asdf_version: ${{ steps.asdf-version.outputs.version }}
tag_format: ${{ steps.load-config.outputs.TAG_FORMAT }}
steps:
- name: Checkout code
uses: actions/checkout@1af3b93b6815bc44a9784bd300feb67ff0d1eeb3
- name: Get asdf version
id: asdf-version
run: echo "version=$(awk '!/^#/ && NF {print $1; exit}' .tool-versions.asdf)" >> "$GITHUB_OUTPUT"
- name: Load config value
id: load-config
run: |
TAG_FORMAT=$(yq '.TAG_FORMAT' .github/config/settings.yml)
echo "TAG_FORMAT=$TAG_FORMAT" >> "$GITHUB_OUTPUT"
quality_checks:
uses: NHSDigital/eps-common-workflows/.github/workflows/quality-checks.yml@3cba6a3733673bafc95526503478674332c26007
needs: [get_asdf_version]
with:
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
secrets:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
get_commit_id:
runs-on: ubuntu-22.04
outputs:
commit_id: ${{ steps.commit_id.outputs.commit_id }}
steps:
- name: Get Commit ID
id: commit_id
run: |
echo "commit_id=${{ github.sha }}" >> "$GITHUB_OUTPUT"
tag_release:
needs: [quality_checks, get_commit_id, get_asdf_version]
uses: NHSDigital/eps-common-workflows/.github/workflows/tag-release.yml@3cba6a3733673bafc95526503478674332c26007
with:
dry_run: false
asdfVersion: ${{ needs.get_asdf_version.outputs.asdf_version }}
branch_name: main
publish_package: false
tag_format: ${{ needs.get_asdf_version.outputs.tag_format }}
secrets: inherit
package_code:
needs: [tag_release, get_commit_id]
uses: ./.github/workflows/cdk_package_code.yml
with:
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
release_dev:
needs: [tag_release, package_code, get_commit_id]
uses: ./.github/workflows/cdk_release_code.yml
with:
TARGET_ENVIRONMENT: dev
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
LOG_RETENTION_IN_DAYS: 30
DEPLOY_CHANGE: true
FORWARD_CSOC_LOGS: false
secrets:
CDK_PULL_IMAGE_ROLE: ${{ secrets.DEV_CDK_PULL_IMAGE_ROLE }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_DEPLOY_ROLE }}
create_release_notes:
needs: [tag_release, package_code, get_commit_id, release_dev]
uses: ./.github/workflows/create_release_notes.yml
with:
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
CREATE_INT_RELEASE_NOTES: true
CREATE_INT_RC_RELEASE_NOTES: false
CREATE_PROD_RELEASE_NOTES: true
MARK_JIRA_RELEASED: false
secrets:
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
release_ref:
needs: [tag_release, package_code, get_commit_id, release_dev]
uses: ./.github/workflows/cdk_release_code.yml
with:
TARGET_ENVIRONMENT: ref
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
LOG_RETENTION_IN_DAYS: 30
DEPLOY_CHANGE: true
FORWARD_CSOC_LOGS: false
secrets:
CDK_PULL_IMAGE_ROLE: ${{ secrets.REF_CDK_PULL_IMAGE_ROLE }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.REF_CLOUD_FORMATION_DEPLOY_ROLE }}
release_qa:
needs: [tag_release, package_code, get_commit_id, release_dev]
uses: ./.github/workflows/cdk_release_code.yml
with:
TARGET_ENVIRONMENT: qa
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
LOG_RETENTION_IN_DAYS: 30
DEPLOY_CHANGE: true
FORWARD_CSOC_LOGS: false
secrets:
CDK_PULL_IMAGE_ROLE: ${{ secrets.QA_CDK_PULL_IMAGE_ROLE }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.QA_CLOUD_FORMATION_DEPLOY_ROLE }}
create_rc_release_notes:
needs: [tag_release, package_code, get_commit_id, release_dev, release_qa]
uses: ./.github/workflows/create_release_notes.yml
with:
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
CREATE_INT_RELEASE_NOTES: false
CREATE_INT_RC_RELEASE_NOTES: true
CREATE_PROD_RELEASE_NOTES: false
MARK_JIRA_RELEASED: false
secrets:
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
release_int:
needs:
[
tag_release,
package_code,
get_commit_id,
release_qa,
create_rc_release_notes,
]
uses: ./.github/workflows/cdk_release_code.yml
with:
TARGET_ENVIRONMENT: int
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
LOG_RETENTION_IN_DAYS: 30
DEPLOY_CHANGE: true
FORWARD_CSOC_LOGS: false
secrets:
CDK_PULL_IMAGE_ROLE: ${{ secrets.INT_CDK_PULL_IMAGE_ROLE }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.INT_CLOUD_FORMATION_DEPLOY_ROLE }}
create_release_notes_post_int:
needs:
[
tag_release,
package_code,
get_commit_id,
release_dev,
release_qa,
release_int,
]
uses: ./.github/workflows/create_release_notes.yml
with:
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
CREATE_INT_RELEASE_NOTES: true
CREATE_INT_RC_RELEASE_NOTES: false
CREATE_PROD_RELEASE_NOTES: false
MARK_JIRA_RELEASED: false
secrets:
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
release_prod:
needs: [tag_release, package_code, get_commit_id, release_int]
uses: ./.github/workflows/cdk_release_code.yml
with:
TARGET_ENVIRONMENT: prod
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
COMMIT_ID: ${{needs.get_commit_id.outputs.commit_id}}
LOG_RETENTION_IN_DAYS: 30
DEPLOY_CHANGE: true
FORWARD_CSOC_LOGS: true
secrets:
CDK_PULL_IMAGE_ROLE: ${{ secrets.PROD_CDK_PULL_IMAGE_ROLE }}
CLOUD_FORMATION_DEPLOY_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_DEPLOY_ROLE }}
create_release_notes_post_prod:
needs:
[
tag_release,
package_code,
get_commit_id,
release_dev,
release_qa,
release_int,
release_prod,
]
uses: ./.github/workflows/create_release_notes.yml
with:
VERSION_NUMBER: ${{needs.tag_release.outputs.version_tag}}
CREATE_INT_RELEASE_NOTES: false
CREATE_INT_RC_RELEASE_NOTES: false
CREATE_PROD_RELEASE_NOTES: true
MARK_JIRA_RELEASED: true
secrets:
DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_EXECUTE_LAMBDA_ROLE }}
DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.DEV_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
INT_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.INT_CLOUD_FORMATION_CHECK_VERSION_ROLE }}
PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE: ${{ secrets.PROD_CLOUD_FORMATION_CHECK_VERSION_ROLE }}