-
Notifications
You must be signed in to change notification settings - Fork 1
62 lines (61 loc) · 2.59 KB
/
update-manifests.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
57
58
59
60
61
62
name: Update Manifests (Deploy)
on:
workflow_run:
workflows: ["Test Registration App"]
types: [completed]
branches: [develop, main]
jobs:
on-success:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- name: Get HEAD sha
id: get-sha
run: |
export GIT_HEAD_SHA=$(git rev-parse HEAD)
echo "::set-output name=gitsha::$GIT_HEAD_SHA"
- name: Prepare deploy key
uses: webfactory/ssh-agent@v0.5.3
with:
ssh-private-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}
- name: Check out manifest repo
uses: actions/checkout@v4
with:
ssh-key: ${{ secrets.MANIFEST_REPO_DEPLOY_KEY }}
repository: ${{ secrets.MANIFEST_REPO }}
- name: Set global git config
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
- name: Set SHA in dev manifest for cas-reg-backend and cas-reg-frontend
shell: bash
run: |
pushd cas-reg-backend
GIT_HEAD_SHA=${{ steps.get-sha.outputs.gitsha }}
sed -i "s/sourceRepoImageTag:.*/sourceRepoImageTag: $GIT_HEAD_SHA/g" values-dev.yaml
popd && pushd cas-reg-frontend
sed -i "s/sourceRepoImageTag:.*/sourceRepoImageTag: $GIT_HEAD_SHA/g" values-dev.yaml
git commit -am "Update source SHA for deploy"
git push origin
echo 'Manifest repository has been updated."'
# if: github.ref == 'refs/heads/develop'
- name: Set SHA in test and prod manifest for cas-reg-backend and cas-reg-frontend
shell: bash
run: |
pushd cas-reg-backend
GIT_HEAD_SHA=${{ steps.get-sha.outputs.gitsha }}
sed -i "s/sourceRepoImageTag:.*/sourceRepoImageTag: $GIT_HEAD_SHA/g" values-test.yaml
sed -i "s/sourceRepoImageTag:.*/sourceRepoImageTag: $GIT_HEAD_SHA/g" values-prod.yaml
popd && pushd cas-reg-frontend
sed -i "s/sourceRepoImageTag:.*/sourceRepoImageTag: $GIT_HEAD_SHA/g" values-test.yaml
sed -i "s/sourceRepoImageTag:.*/sourceRepoImageTag: $GIT_HEAD_SHA/g" values-prod.yaml
git commit -am "Update source SHA for deploy"
git push origin
echo 'Manifest repository has been updated."'
if: github.ref == 'refs/heads/main'
on-failure:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'failure' }}
steps:
- run: echo 'Test Registration App workflow has failed. Manifest repository was not updated."'