1010 types : [opened, reopened]
1111
1212jobs :
13+
1314 metadata :
14- name : " Set CI/CD metadata"
15+ name : Set CI/CD metadata
1516 runs-on : ubuntu-latest
1617 timeout-minutes : 1
18+ permissions :
19+ pull-requests : read
1720 outputs :
1821 build_datetime_london : ${{ steps.variables.outputs.build_datetime_london }}
1922 build_datetime : ${{ steps.variables.outputs.build_datetime }}
@@ -22,11 +25,14 @@ jobs:
2225 nodejs_version : ${{ steps.variables.outputs.nodejs_version }}
2326 python_version : ${{ steps.variables.outputs.python_version }}
2427 terraform_version : ${{ steps.variables.outputs.terraform_version }}
28+ environment_tag : ${{ steps.variables.outputs.environment_tag }}
2529 version : ${{ steps.variables.outputs.version }}
2630 does_pull_request_exist : ${{ steps.pr_exists.outputs.does_pull_request_exist }}
2731 steps :
2832 - name : " Checkout code"
2933 uses : actions/checkout@v4
34+ with :
35+ submodules : ' true'
3036 - name : " Set CI/CD variables"
3137 id : variables
3238 run : |
@@ -40,10 +46,11 @@ jobs:
4046 echo "python_version=$(grep "^nodejs" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
4147 echo "terraform_version=$(grep "^terraform" .tool-versions | cut -f2 -d' ')" >> $GITHUB_OUTPUT
4248 echo "version=$(head -n 1 .version 2> /dev/null || echo unknown)" >> $GITHUB_OUTPUT
49+ echo "environment_tag=development" >> $GITHUB_OUTPUT
4350 - name : " Check if pull request exists for this branch"
4451 id : pr_exists
4552 env :
46- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
53+ GH_TOKEN : ${{ github.token }}
4754 run : |
4855 branch_name=${GITHUB_HEAD_REF:-$(echo $GITHUB_REF | sed 's#refs/heads/##')}
4956 echo "Current branch is '$branch_name'"
5461 echo "Pull request doesn't exist"
5562 echo "does_pull_request_exist=false" >> $GITHUB_OUTPUT
5663 fi
57- - name : " List variables"
64+ - name : List variables
5865 run : |
5966 export BUILD_DATETIME_LONDON="${{ steps.variables.outputs.build_datetime_london }}"
6067 export BUILD_DATETIME="${{ steps.variables.outputs.build_datetime }}"
@@ -63,11 +70,12 @@ jobs:
6370 export NODEJS_VERSION="${{ steps.variables.outputs.nodejs_version }}"
6471 export PYTHON_VERSION="${{ steps.variables.outputs.python_version }}"
6572 export TERRAFORM_VERSION="${{ steps.variables.outputs.terraform_version }}"
73+ export ENVIRONMENT_TAG="${{ steps.variables.outputs.environment_tag }}"
6674 export VERSION="${{ steps.variables.outputs.version }}"
6775 export DOES_PULL_REQUEST_EXIST="${{ steps.pr_exists.outputs.does_pull_request_exist }}"
6876 make list-variables
6977 commit-stage : # Recommended maximum execution time is 2 minutes
70- name : " Commit stage"
78+ name : Commit stage
7179 needs : [metadata]
7280 uses : ./.github/workflows/stage-1-commit.yaml
7381 with :
@@ -92,23 +100,21 @@ jobs:
92100 terraform_version : " ${{ needs.metadata.outputs.terraform_version }}"
93101 version : " ${{ needs.metadata.outputs.version }}"
94102 secrets : inherit
95- build-stage : # Recommended maximum execution time is 3 minutes
96- name : " Build stage"
97- needs : [metadata, test-stage]
98- uses : ./ .github/workflows/stage-3-build.yaml
99- if : needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
103+ build-image- stage : # Recommended maximum execution time is 3 minutes
104+ name : Image build stage
105+ needs : [metadata, commit-stage, test-stage]
106+ uses : NHSDigital/dtos-devops-templates/ .github/workflows/stage-3-build-images .yaml@main
107+ if : needs.metadata.outputs.does_pull_request_exist == 'true' || github.ref == 'refs/heads/main' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
100108 with :
101- build_datetime : " ${{ needs.metadata.outputs.build_datetime }}"
102- build_timestamp : " ${{ needs.metadata.outputs.build_timestamp }}"
103- build_epoch : " ${{ needs.metadata.outputs.build_epoch }}"
104- nodejs_version : " ${{ needs.metadata.outputs.nodejs_version }}"
105- python_version : " ${{ needs.metadata.outputs.python_version }}"
106- terraform_version : " ${{ needs.metadata.outputs.terraform_version }}"
107- version : " ${{ needs.metadata.outputs.version }}"
109+ docker_compose_file : ./compose.yaml
110+ excluded_containers_csv_list : azurite,azurite-setup,sql-database,database-setup
111+ environment_tag : ${{ needs.metadata.outputs.environment_tag }}
112+ function_app_source_code_path : src
113+ project_name : service-layer
108114 secrets : inherit
109115 acceptance-stage : # Recommended maximum execution time is 10 minutes
110- name : " Acceptance stage"
111- needs : [metadata, build-stage]
116+ name : Acceptance stage
117+ needs : [metadata, build-image- stage]
112118 uses : ./.github/workflows/stage-4-acceptance.yaml
113119 if : needs.metadata.outputs.does_pull_request_exist == 'true' || (github.event_name == 'pull_request' && (github.event.action == 'opened' || github.event.action == 'reopened'))
114120 with :
@@ -120,3 +126,20 @@ jobs:
120126 terraform_version : " ${{ needs.metadata.outputs.terraform_version }}"
121127 version : " ${{ needs.metadata.outputs.version }}"
122128 secrets : inherit
129+ validate-title-stage :
130+ name : Validate PR title
131+ runs-on : ubuntu-latest
132+ permissions :
133+ pull-requests : write
134+ env :
135+ GITHUB_TOKEN : ${{ github.token }}
136+ if : github.event_name == 'pull_request'
137+ steps :
138+ - uses : amannn/action-semantic-pull-request@v5
139+ id : validate
140+
141+ - uses : thollander/actions-comment-pull-request@v3
142+ if : ${{ failure() && steps.validate.conclusion == 'failure' }}
143+ with :
144+ message : |
145+ Your Pull Request title must meet the conventional commit standards, please see the following documentation - https://www.conventionalcommits.org/en/v1.0.0/#specification
0 commit comments