-
Notifications
You must be signed in to change notification settings - Fork 0
42 lines (39 loc) · 1.89 KB
/
cd.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
name: Repository Dispatch
on:
repository_dispatch:
types:
- argocd
- argocd-manual
permissions:
contents: write
jobs:
build:
name: Set ${{ github.event.client_payload.repository }} deployment image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Update image version
if: github.event.client_payload.environment != ''
uses: mikefarah/[email protected]
with:
cmd: yq -i '.spec.template.spec.containers[0].image = "${{ github.event.client_payload.image }}"' ${{ github.event.client_payload.repository }}/${{ github.event.client_payload.environment }}/deployment.yaml
- name: Update image version
if: github.event.client_payload.environment == '' && github.event.client_payload.ref == 'develop'
uses: mikefarah/[email protected]
with:
cmd: yq -i '.spec.template.spec.containers[0].image = "${{ github.event.client_payload.image }}"' ${{ github.event.client_payload.repository }}/dev/deployment.yaml
- name: Update image version
if: github.event.client_payload.environment == '' && github.event.client_payload.ref == 'release'
uses: mikefarah/[email protected]
with:
cmd: yq -i '.spec.template.spec.containers[0].image = "${{ github.event.client_payload.image }}"' ${{ github.event.client_payload.repository }}/stage/deployment.yaml
- name: Set commit message
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event.client_payload.environment == ''
with:
commit_message: "${{ format('[{0}]: {1}', github.event.client_payload.ref, github.event.client_payload.commit_msg) }}"
- name: Set commit message
uses: stefanzweifel/git-auto-commit-action@v5
if: github.event.client_payload.environment != ''
with:
commit_message: "${{ format('[{0}]: Manual deployment triggered by @{1}', github.event.client_payload.ref, github.event.client_payload.actor) }}"