55 branches :
66 - main
77 workflow_dispatch :
8+ # 수동 실행 시, 태그 지정 된 것으로 배포됨. push로 자동 실행 시, 해당 push로 만들어진 sha태그로 배포됨.
89 inputs :
910 tag :
1011 description : ' Optional explicit prod tag (default: prod-latest)'
4748 test -s src/main/resources/applicant-sync-mapping-data.yml
4849 head -n 2 src/main/resources/applicant-sync-mapping-data.yml
4950
50- - name : Cache Gradle packages
51- uses : actions/cache@v4
52- with :
53- path : |
54- ~/.gradle/caches
55- ~/.gradle/wrapper
56- key : ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
57- restore-keys : |
58- ${{ runner.os }}-gradle-
59-
6051 - name : Clean Build with Gradle (with Testing)
6152 env :
6253 JWT_ACCESS_KEY : ${{ secrets.JWT_ACCESS_KEY }}
@@ -105,15 +96,6 @@ jobs:
10596 with :
10697 registry-type : public
10798
108- - name : Cache Docker layers
109- uses : actions/cache@v4
110- with :
111- path : /tmp/.buildx-cache
112- key : ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }}-${{ github.sha }}
113- restore-keys : |
114- ${{ runner.os }}-buildx-${{ hashFiles('Dockerfile') }}-
115- ${{ runner.os }}-buildx-
116-
11799 - name : Build, tag, and push image to Amazon ECR
118100 env :
119101 ECR_REGISTRY : public.ecr.aws/${{ vars.ECR_PUBLIC_REGISTRY_ID }}
@@ -132,15 +114,11 @@ jobs:
132114 --push \
133115 --provenance=false \
134116 --cache-from "type=gha" \
135- --cache-from "type=local,src=/tmp/.buildx-cache" \
136117 --cache-to "type=gha,mode=max" \
137- --cache-to "type=local,dest=/tmp/.buildx-cache-new,mode=max" \
138118 -t $ECR_REGISTRY/$ECR_REPOSITORY:$PROD_IMAGE_SHA_TAG \
139119 -t $ECR_REGISTRY/$ECR_REPOSITORY:$PROD_IMAGE_LATEST_TAG \
140120 .
141121
142- rm -rf /tmp/.buildx-cache
143- mv /tmp/.buildx-cache-new /tmp/.buildx-cache
144122
145123 - name : Deploy to AWS EC2
146124 env :
@@ -184,7 +162,7 @@ jobs:
184162 if [ -n "$INPUT_DEPLOY_TAG" ]; then
185163 DEPLOY_TAG="$INPUT_DEPLOY_TAG"
186164 else
187- DEPLOY_TAG="prod-latest "
165+ DEPLOY_TAG="prod-${GITHUB_SHA} "
188166 fi
189167
190168 echo "SERVER_PORT=$SERVER_PORT" >> .env.prod
0 commit comments