forked from equinor/isar-robot
-
Notifications
You must be signed in to change notification settings - Fork 0
58 lines (54 loc) · 1.77 KB
/
update_aurora_deployment.yml
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
name: Update deployment in aurora
on:
workflow_call:
inputs:
Environment:
required: true
type: string
Tag:
required: true
type: string
Registry:
required: true
type: string
ImageName:
required: true
type: string
AuthorEmail:
required: false
type: string
AuthorName:
required: true
type: string
secrets:
DeployKey:
required: true
jobs:
deploy:
name: Update deployment
runs-on: ubuntu-latest
env:
EMAIL: ${{ inputs.AuthorEmail }}
NAME: ${{ inputs.AuthorName }}
steps:
- name: Checkout infrastructure
uses: actions/checkout@v4
with:
ref: main
repository: equinor/robotics-infrastructure
ssh-key: ${{ secrets.DeployKey }}
- name: Update image in file
run: |
LINE_NUMBERS=($(grep -n "${{ inputs.Registry }}/${{ inputs.ImageName }}" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml | cut -d ':' -f 1))
for line_number in "${LINE_NUMBERS[@]}"
do
TAG_LINE_NUMBER=$((line_number+1))
sed -i "${TAG_LINE_NUMBER} s/newTag:.*/newTag: ${{ inputs.Tag }}/" "k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml"
done
- name: Update infrastructure in GitHub
run: |
git config --global user.email "${EMAIL}"
git config --global user.name "GitHub Actions (${NAME})"
git add k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml
git commit --message "GHA: Update Isar-Robot in ${{ inputs.Environment }} (${{ inputs.Tag }})" || true
git push