-
Notifications
You must be signed in to change notification settings - Fork 11
52 lines (50 loc) · 1.56 KB
/
render-manifests.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
name: Render Manifests
on:
push:
branches:
- main
jobs:
render-manifests:
name: Render manifests
runs-on: ubuntu-latest
strategy:
matrix:
env: [dev, stage, prod]
steps:
- uses: actions/checkout@v3
with:
# fetch-depth: 0 needed to get all branches
fetch-depth: 0
- uses: fregante/setup-git-user@v1
-
name: Render manifests
run: |
kustomize build env/${{ matrix.env }} > /tmp/all.yaml
if ! git checkout env/${{ matrix.env }} -- ; then
git checkout --orphan env/${{ matrix.env }}
git rm -rf .
cp /tmp/all.yaml .
git add .
git commit -m "${{ github.event.head_commit.message }}"
git push --set-upstream origin env/${{ matrix.env }}
else
cp /tmp/all.yaml .
fi
-
name: Deploy to ${{ matrix.env }}
if: ${{ matrix.env == 'dev' || matrix.env == 'stage' }}
run: |
if ! git diff --quiet HEAD ; then
git add .
git commit -m "${{ github.event.head_commit.message }}"
git push --set-upstream origin env/${{ matrix.env }}
fi
-
name: Deploy PR to ${{ matrix.env }}
uses: peter-evans/create-pull-request@v4
if: ${{ matrix.env == 'prod' }}
with:
title: ${{ github.event.head_commit.message }}
commit-message: ${{ github.event.head_commit.message }}
base: env/${{ matrix.env }}
branch: deploy-pr/env/${{ matrix.env }}