chore: 프로메테우스 연동을 위한 설정 #13
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: user service development build & docker hub push | |
on: | |
push: | |
branches: ["development"] | |
paths: | |
- "user-service/**" | |
- ".github/workflows/user-service-dev.yaml" | |
env: | |
SPRING_PROFILE: dev | |
IMAGE_NAME: dlckdals6183/user-service-dev | |
MODULE_PATH: user-service | |
SERVER_PORT: 8080 | |
GIT_ENVIRONMENT: development (user-service) | |
concurrency: | |
group: user-service | |
jobs: | |
prepare-variables: | |
name: 환경변수 setting | |
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: checkout | |
uses: actions/checkout@v3 | |
- name: 환경변수 output | |
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: docker 이미지 build & push | |
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 Deploy | |
uses: ./.github/workflows/argocd-deploy.yaml | |
permissions: | |
contents: write | |
with: | |
argocd-repo-name: TEAM-YOAJUNG/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: dlckdals6183/user-service | |
secrets: | |
PAT_TOKEN: ${{ secrets.PAT_TOKEN }} |