-
Notifications
You must be signed in to change notification settings - Fork 3
96 lines (85 loc) · 2.67 KB
/
tool-create-release.yml
File metadata and controls
96 lines (85 loc) · 2.67 KB
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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
name: "TOOL: Create Release"
run-name: ${{ inputs.tag }}
on:
workflow_dispatch:
inputs:
tag:
description: "Release Tag (format: X.Y.Z, e.g. 1.0.0)"
required: true
permissions: {}
jobs:
create_release:
name: Run Full Deployment and Re-tag Services
runs-on: ubuntu-latest
environment: dev
permissions:
id-token: write
contents: write
env:
tag: ${{ inputs.tag }}
steps:
- name: Validate Tag Format
run: |
if [[ ! "$tag" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then
echo "Error: Tag must be in the format X.Y.Z (e.g. 1.0.0)"
exit 1
fi
- name: Checkout
uses: actions/checkout@v6
- name: Create GitHub Tag
run: |
git config user.name "github-actions[bot]"
git config user.email "github-actions[bot]@users.noreply.github.com"
git tag $tag
git push origin $tag
full-deployment:
name: Full Deployment
needs: create_release
permissions:
contents: write
id-token: write
pull-requests: write
uses: ./.github/workflows/full-deployment.yml
secrets: inherit
re-tag-services:
name: Re-tag Services with Release Tag
needs: full-deployment
runs-on: ubuntu-latest
environment: dev
permissions:
id-token: write
contents: write
env:
tag: ${{ inputs.tag }}
steps:
- name: Configure AWS Credentials
id: credentials
uses: aws-actions/configure-aws-credentials@8df5847569e6427dd6c4fb1cf565c83acfa8afa7 # v6.0.0
with:
role-to-assume: ${{ secrets.IAM_ROLE }}
aws-region: ${{ vars.AWS_REGION }}
role-skip-session-tagging: true
mask-aws-account-id: true
- name: Login to Amazon ECR
id: ecr-login
uses: aws-actions/amazon-ecr-login@v2
- name: Re-tag ECR Images with Release Tag
env:
IMAGE_SHA: ${{ github.sha }}
run: |
repo_list=("deductions/ehr-out-service"
"deductions/ehr-repo"
"deductions/ehr-transfer-service"
"deductions/gp2gp-messenger"
"deductions/mesh-forwarder"
"deductions/nems-event-processor"
"deductions/pds-adaptor"
"repo/re-registration-service"
"repo/suspension-service"
)
for repo in "${repo_list[@]}"; do
full_repo="${{ steps.credentials.outputs.aws-account-id }}.dkr.ecr.eu-west-2.amazonaws.com/${repo}"
docker pull "${full_repo}:${IMAGE_SHA}"
docker tag "${full_repo}:${IMAGE_SHA}" "${full_repo}:${tag}"
docker push "${full_repo}:${tag}"
done