-
Notifications
You must be signed in to change notification settings - Fork 37
67 lines (61 loc) · 2.5 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
59
60
61
62
63
64
65
66
67
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@v3
with:
ref: main
repository: equinor/robotics-infrastructure
ssh-key: ${{ secrets.DeployKey }}
- name: Update frontend in file
run: |
COMPONENT=frontend
TAG_LINE_NUMBER=$(($(grep -n "${{ inputs.Registry }}/${{ inputs.ImageName }}-${COMPONENT}" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml | cut --delimiter=":" --fields=1)+1))
sed -i "${TAG_LINE_NUMBER} s/newTag:.*/newTag: ${{ inputs.Tag }}/" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml
- name: Update backend in file
run: |
COMPONENT=backend
TAG_LINE_NUMBER=$(($(grep -n "${{ inputs.Registry }}/${{ inputs.ImageName }}-${COMPONENT}" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml | cut --delimiter=":" --fields=1)+1))
sed -i "${TAG_LINE_NUMBER} s/newTag:.*/newTag: ${{ inputs.Tag }}/" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml
- name: Update broker in file
run: |
COMPONENT=broker
TAG_LINE_NUMBER=$(($(grep -n "${{ inputs.Registry }}/${{ inputs.ImageName }}-${COMPONENT}" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml | cut --delimiter=":" --fields=1)+1))
sed -i "${TAG_LINE_NUMBER} s/newTag:.*/newTag: ${{ inputs.Tag }}/" k8s_kustomize/overlays/${{ inputs.Environment }}/kustomization.yaml
- 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 Flotilla in ${{ inputs.Environment }} (${{ inputs.Tag }})" || true
git push