-
Notifications
You must be signed in to change notification settings - Fork 0
80 lines (70 loc) · 2.11 KB
/
2_wf_deploy.yaml
File metadata and controls
80 lines (70 loc) · 2.11 KB
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
71
72
73
74
75
76
77
78
79
80
name: wf_deploy
on:
workflow_call:
inputs:
APP_NAME:
required: true
type: string
IMAGE_TAG:
required: true
type: string
DOCKER_URL:
required: true
type: string
DOCKER_USERNAME:
required: true
type: string
secrets:
DOCKER_PASSWORD:
required: true
PERSONAL_TOKEN:
required: true
jobs:
deploy:
name: Deploy_${{ inputs.APP_NAME }}
runs-on: ubuntu-22.04
timeout-minutes: 20
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Checkout infra repository
uses: actions/checkout@v4
with:
repository: OnlyLight/dev-infra
ref: main
token: ${{ secrets.PERSONAL_TOKEN }}
- name: Determine Blue-Green Environment
working-directory: helm
run: |
case ${{ inputs.APP_NAME }} in
"crawler-api")
cd application/app/api/
;;
"consumer-app")
cd application/scrape_data/consumer/
;;
"crawler-app")
cd application/scrape_data/migrate-init/
;;
"crawler-app-migrate")
cd application/scrape_data/migrate/
;;
esac
CURRENT_ENV=$(yq e '.environment.active' ./values.yaml)
if [ "$CURRENT_ENV" = "blue" ]; then
NEW_ENV="green"
else
NEW_ENV="blue"
fi
echo "new_env=${NEW_ENV}"
echo "new_env=${NEW_ENV}" >> $GITHUB_ENV
# Update Helm Values for new env
yq e -i ".environment.active = \"${{ env.new_env }}\"" ./values.yaml
yq e -i ".image.tag = \"${{ inputs.IMAGE_TAG }}\"" ./values.yaml
# - name: Commit and Push Changes
# run: |
# git config user.email "CI@gmail.com"
# git config user.name "CI"
# git add .
# git commit -m "Update image to ${{ inputs.APP_NAME }} with tag ${{ inputs.IMAGE_TAG }} on environment ${{ env.new_env }}" || true
# git push origin main || true