diff --git a/.github/workflows/api-gateway.yaml b/.github/workflows/api-gateway.yaml index 0812c4ba..b192cab2 100644 --- a/.github/workflows/api-gateway.yaml +++ b/.github/workflows/api-gateway.yaml @@ -54,3 +54,19 @@ jobs: 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: spinachpasta/api-gateway + image-tag: ${{ needs.prepare-variables.outputs.image-tag }} + environment: ${{ needs.prepare-variables.outputs.spring-profile }} + secrets: + PAT_TOKEN: ${{ secrets.PAT_TOKEN }} diff --git a/.github/workflows/argocd-deploy.yaml b/.github/workflows/argocd-deploy.yaml new file mode 100644 index 00000000..7944ddc5 --- /dev/null +++ b/.github/workflows/argocd-deploy.yaml @@ -0,0 +1,52 @@ +name: ArgoCD로 배포하기 +on: + workflow_call: + inputs: + argocd-repo-name: + required: true + type: string + overlay-name: + required: true + type: string + service-name: + required: true + type: string + image-name: + required: true + type: string + environment: + required: true + type: string + image-tage: + required: true + type: string + secrets: + PAT_TOKEN: + required: true + +jobs: + build: + runs-on: [ ubuntu-latest ] + name: ArgoCD로 배포하기 + + environment: ${{ inputs.environment }} + + steps: + - name: GitHub 에서 레포 받아오기 + uses: actions/checkout@v3 + with: + repository: ${{ inputs.argocd-repo-name }} + token: ${{ secrets.PAT_TOKEN }} + + - name: Kustomize 설정하기 + uses: imranismail/setup-kustomize@v2 + + - name: 이미지 태그 변경 후 배포하기 + run: | + cd modules/${{ inputs.service-name }}/overlays/${{ inputs.overlay-name }} + kustomize edit set image ${{ inputs.image-name }}:${{ inputs.image-tag }} + cat kustomization.yaml + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git commit -am "deploy(${{ inputs.service-name }}): 자동배포 ${{ inputs.image-name }}" + git push -u origin main diff --git a/api-gateway/build.gradle.kts b/api-gateway/build.gradle.kts index 3af71356..77686519 100644 --- a/api-gateway/build.gradle.kts +++ b/api-gateway/build.gradle.kts @@ -21,7 +21,6 @@ repositories { extra["springCloudVersion"] = "2023.0.2" dependencies { - //implementation("org.springframework.boot:spring-boot-starter-security") implementation("org.springframework.cloud:spring-cloud-starter-gateway") implementation("org.springframework.boot:spring-boot-starter-actuator") implementation("org.springdoc:springdoc-openapi-starter-webflux-ui:2.5.0")