-
Notifications
You must be signed in to change notification settings - Fork 2
70 lines (63 loc) · 2.11 KB
/
prep_4_s3_deploy.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
68
69
70
# @file: prep_3_s3_deploy.yml
# This actions will (force) push changes to deploy-branches if the corresponding config file changes
#
name: "(Force) Push Changes to deploy-branches"
on:
workflow_dispatch:
push:
branches:
- master
# pull_request:
# branches:
# - master
jobs:
Deploy:
runs-on: ubuntu-20.04
defaults:
run:
shell: bash
steps:
- name: Checkout the repository
uses: actions/checkout@v4
- name: Get all changed config files
id: changed-config-files
uses: tj-actions/changed-files@v44
with:
# Avoid using single or double quotes for multiline patterns
files: |
**.yaml
- name: (Force) Push to Deploy Branches
if: steps.changed-config-files.outputs.any_changed == 'true'
env:
ALL_CHANGED_FILES: ${{ steps.changed-config-files.outputs.all_changed_files }}
ACTOR: ${{ github.actor }}
EMAIL: "${{ github.actor }}@users.noreply.github.com"
run: |
if [[ ${#ALL_CHANGED_FILES[@]} -gt 0 ]]
then
for file in ${ALL_CHANGED_FILES}; do
echo "$file was changed"
if [[ $file == src/configs/test/apps.yaml ]]
then
TARGET=deploy-test
fi
if [[ $file == src/configs/dev/apps.yaml ]]
then
TARGET=deploy-dev
fi
if [[ $file == src/configs/prod/apps.yaml ]]
then
TARGET=deploy-prod
fi
echo "TARGET_BRANCH Below:"
echo "$TARGET | ${TARGET}"
echo "Actor: $ACTOR"
echo "EMAIL: $EMAIL"
git config --global user.name "$ACTOR"
git config --global user.email "$EMAIL"
echo "git config user.name: [$(git config user.name)]"
echo "git config user.email: [$(git config user.email)]"
git checkout -b ${TARGET}
git push -uf --no-verify origin ${TARGET}
done
fi