generated from NHSDigital/nhs-notify-repository-template
-
Notifications
You must be signed in to change notification settings - Fork 0
56 lines (49 loc) · 1.7 KB
/
pr_closed.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: PR Closed
on:
workflow_dispatch:
pull_request:
types: [closed]
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: false
jobs:
check-merge-or-workflow-dispatch:
runs-on: ubuntu-latest
outputs:
deploy: ${{ steps.check.outputs.deploy }}
steps:
- name: Check if PR was merged or wor§kflow is triggered by workflow_dispatch
id: check
run: |
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
echo "deploy=true" >> $GITHUB_OUTPUT
echo "Job triggered by workflow_dispatch - running 'deploy-main'"
elif [[ "${{ github.event_name }}" == "pull_request" && "${{ github.event.pull_request.merged }}" == "true" ]]; then
echo "deploy=true" >> $GITHUB_OUTPUT
echo "Job triggered by Merged PR - running 'deploy-main'"
else
echo "deploy=false" >> $GITHUB_OUTPUT
echo "Job not triggered by workflow_dispatch or Merged PR - Skipping 'deploy-main'"
fi
deploy-main:
needs: check-merge-or-workflow-dispatch
name: Deploy changes to main in dev AWS account
if: needs.check-merge-or-workflow-dispatch.outputs.deploy == 'true'
permissions:
id-token: write
contents: read
strategy:
max-parallel: 1
matrix:
component: [acct, cdn]
uses: ./.github/workflows/reusable_internal_repo_build.yaml
secrets: inherit
with:
release_version: main
target_workflow: "dispatch-deploy-static-notify-web-gateway.yaml"
tf_environment: "main"
tf_group: "nhs-notify-web-dev"
tf_component: ${{ matrix.component }}
tf_action: "apply"