Skip to content

Commit e52e4ae

Browse files
committed
NRL-1595 Pull target branch and environment from inputs - needs testing once merged
1 parent 21014f9 commit e52e4ae

File tree

1 file changed

+12
-19
lines changed

1 file changed

+12
-19
lines changed

.github/workflows/deploy-account-wide-infra.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,5 @@
11
name: Deploy Account-wide infrastructure
2-
run-name: Account-wide infra deployment to ${{ 'account-dev' }} of ${{ github.ref_name }} by ${{ github.actor }}
3-
4-
# Tidy up your commit history gurl!!
5-
6-
# Put together better PR desceriptuion https://github.com/NHSDigital/NRLF/pull/1098
2+
run-name: Account-wide infra deployment to ${{ inputs.environment }} of ${{ inputs.branch_name }} by ${{ github.actor }}
73

84
on:
95
workflow_dispatch:
@@ -16,9 +12,6 @@ on:
1612
branch_name:
1713
description: Branch to deploy
1814
required: true
19-
push:
20-
branches:
21-
- NRL-1595**
2215

2316
permissions:
2417
id-token: write
@@ -32,7 +25,7 @@ jobs:
3225
steps:
3326
- name: Validate environment
3427
env:
35-
IS_VALID_ENV: ${{ startsWith('account-dev', 'account-') }}
28+
IS_VALID_ENV: ${{ startsWith(inputs.environment, 'account-') }}
3629
run: |
3730
echo "valid workflow environment selected:" $IS_VALID_ENV
3831
if [[ $IS_VALID_ENV == true ]]; then
@@ -41,16 +34,16 @@ jobs:
4134
exit 1
4235
4336
terraform-plan:
44-
name: Terraform Plan - ${{ 'account-dev' }}
45-
environment: ${{ 'account-dev' }}
37+
name: Terraform Plan - ${{ inputs.environment }}
38+
environment: ${{ inputs.environment }}
4639
needs: [check-selected-environment]
4740
runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }}
4841

4942
steps:
50-
- name: Git clone - ${{ github.ref_name }}
43+
- name: Git clone - ${{ inputs.branch_name }}
5144
uses: actions/checkout@v4
5245
with:
53-
ref: ${{ github.ref_name }}
46+
ref: ${{ inputs.branch_name }}
5447

5548
- name: Setup environment
5649
run: |
@@ -62,7 +55,7 @@ jobs:
6255
with:
6356
aws-region: eu-west-2
6457
role-to-assume: ${{ secrets.MGMT_ROLE_ARN }}
65-
role-session-name: github-actions-ci-${{ 'account-dev' }}-${{ github.run_id }}
58+
role-session-name: github-actions-ci-${{ inputs.environment }}-${{ github.run_id }}
6659

6760
- name: Retrieve Server Certificates
6861
env:
@@ -98,16 +91,16 @@ jobs:
9891
aws s3 cp terraform/account-wide-infrastructure/$ACCOUNT_NAME/tfplan.txt s3://nhsd-nrlf--mgmt--github-ci-logging/acc-$ACCOUNT_NAME/${{ github.run_id }}/tfplan.txt
9992
10093
terraform-apply:
101-
name: Terraform Apply - ${{ 'account-dev' }}
94+
name: Terraform Apply - ${{ inputs.environment }}
10295
needs: [terraform-plan]
10396
runs-on: codebuild-nhsd-nrlf-ci-build-project-${{ github.run_id }}-${{ github.run_attempt }}
104-
environment: ${{ 'account-dev' }}
97+
environment: ${{ inputs.environment }}
10598

10699
steps:
107-
- name: Git clone - ${{ github.ref_name }}
100+
- name: Git clone - ${{ inputs.branch_name }}
108101
uses: actions/checkout@v4
109102
with:
110-
ref: ${{ github.ref_name }}
103+
ref: ${{ inputs.branch_name }}
111104

112105
- name: Setup environment
113106
run: |
@@ -119,7 +112,7 @@ jobs:
119112
with:
120113
aws-region: eu-west-2
121114
role-to-assume: ${{ secrets.MGMT_ROLE_ARN }}
122-
role-session-name: github-actions-ci-${{ 'account-dev' }}-${{ github.run_id}}
115+
role-session-name: github-actions-ci-${{ inputs.environment }}-${{ github.run_id}}
123116

124117
- name: Download Terraform Plan artifact
125118
env:

0 commit comments

Comments
 (0)