-
Notifications
You must be signed in to change notification settings - Fork 1
77 lines (71 loc) · 2.86 KB
/
api-gateway.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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: API 게이트웨이 빌드 후 도커허브에 올리기
on:
push:
branches: [ 'main' ]
paths:
- 'api-gateway/**' # API Gateway 모듈 변경
- '.github/workflows/api-gateway.yaml' # API Gateway 워크플로우 변경
env:
SPRING_PROFILE: prod
IMAGE_NAME: spinachpasta/api-gateway
MODULE_PATH: api-gateway
SERVER_PORT: 8080
GIT_ENVIRONMENT: prod (api-gateway)
concurrency:
group: api-gateway
jobs:
prepare-variables:
name: 환경변수 준비하기
runs-on: ubuntu-latest
outputs:
image-tag: ${{ steps.setup-env.outputs.image-tag }}
module-path: ${{ steps.setup-env.outputs.module-path }}
spring-profile: ${{ steps.setup-env.outputs.spring-profile }}
server-port: ${{ steps.setup-env.outputs.server-port }}
image-name: ${{ steps.setup-env.outputs.image-name }}
git-environment: ${{ steps.setup-env.outputs.git-environment }}
steps:
- name: GitHub 에서 레포 받아오기
uses: actions/checkout@v3
- name: 환경변수 출력하기
id: setup-env
run: |
echo "image-tag=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
echo "module-path=$MODULE_PATH" >> $GITHUB_OUTPUT
echo "spring-profile=$SPRING_PROFILE" >> $GITHUB_OUTPUT
echo "server-port=$SERVER_PORT" >> $GITHUB_OUTPUT
echo "image-name=$IMAGE_NAME" >> $GITHUB_OUTPUT
echo "git-environment=$GIT_ENVIRONMENT" >> $GITHUB_OUTPUT
call-build-workflow:
if: github.event_name == 'push'
needs: [ prepare-variables ]
name: 이미지 빌드 & 푸쉬
uses: ./.github/workflows/jib-build.yaml
permissions:
id-token: write
contents: read
with:
spring-profile: ${{ needs.prepare-variables.outputs.spring-profile }}
server-port: ${{ needs.prepare-variables.outputs.server-port }}
image-name: ${{ needs.prepare-variables.outputs.image-name }}
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
module-path: ${{ needs.prepare-variables.outputs.module-path }}
secrets:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
DOCKERHUB_TOKEN: ${{ secrets.DOCKERHUB_TOKEN }}
call-deploy-workflow:
needs: [ prepare-variables, call-build-workflow ]
name: ArgoCD로 배포하기
uses: ./.github/workflows/argocd-deploy.yaml
permissions:
contents: write
with:
argocd-repo-name: YAPP-Github/mafoo-argocd-manifest
overlay-name: ${{ needs.prepare-variables.outputs.spring-profile }}
service-name: ${{ needs.prepare-variables.outputs.module-path }}
image-name: ${{ needs.prepare-variables.outputs.image-name }}
image-tag: ${{ needs.prepare-variables.outputs.image-tag }}
environment: ${{ needs.prepare-variables.outputs.git-environment }}
default-image-name: spinachpasta/api-gateway
secrets:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}