From 8aede9cd3d119d0d467e08803e898123d66accb3 Mon Sep 17 00:00:00 2001 From: isprogrammingfun Date: Wed, 19 Mar 2025 08:04:55 +0900 Subject: [PATCH] =?UTF-8?q?cd=20=ED=94=8C=EB=A1=9C=EC=9A=B0=20=EC=88=98?= =?UTF-8?q?=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD-api.yml | 7 ++----- .github/workflows/CD-office.yml | 8 ++------ .github/workflows/ec2_push.yml | 11 ++++++++--- .github/workflows/gradle_build.yml | 11 +++++++++-- 4 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/CD-api.yml b/.github/workflows/CD-api.yml index f28dbea3..22595f0a 100644 --- a/.github/workflows/CD-api.yml +++ b/.github/workflows/CD-api.yml @@ -15,17 +15,13 @@ on: required: true EC2_KEY: required: true - push: - branches: - - develop - paths: - - 'boot/api/**' jobs: build: uses: ./.github/workflows/gradle_build.yml with: project-name: api + workflow-id: ${{ github.run_id }} push-image: needs: build @@ -38,6 +34,7 @@ jobs: ecr-repository-name: clibi/api container-name: api-server secret-manager: arn:aws:secretsmanager:ap-northeast-2:442042528525:secret:dev/clibi/rds-eCWfXL + workflow-id: ${{ github.run_id }} secrets: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/CD-office.yml b/.github/workflows/CD-office.yml index 8f47846c..d4462024 100644 --- a/.github/workflows/CD-office.yml +++ b/.github/workflows/CD-office.yml @@ -16,17 +16,12 @@ on: EC2_KEY: required: true - push: - branches: - - develop - paths: - - 'boot/api/**' - jobs: build: uses: ./.github/workflows/gradle_build.yml with: project-name: office + workflow-id: ${{ github.run_id }} push-image: needs: build @@ -39,6 +34,7 @@ jobs: ecr-repository-name: clibi/office secret-manager: arn:aws:secretsmanager:ap-northeast-2:442042528525:secret:dev/clibi/rds-eCWfXL container-name: office-server + workflow-id: ${{ github.run_id }} secrets: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} diff --git a/.github/workflows/ec2_push.yml b/.github/workflows/ec2_push.yml index c344d175..ac239dc1 100644 --- a/.github/workflows/ec2_push.yml +++ b/.github/workflows/ec2_push.yml @@ -24,6 +24,9 @@ on: container-name: required: true type: string + workflow-id: + required: false + type: string secrets: AWS_ACCESS_KEY_ID: required: true @@ -45,13 +48,15 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Download the gradle Build File uses: actions/download-artifact@v4 with: - name: ${{inputs.project-name}}-build - path: ./boot/${{inputs.project-name}}/build/libs + name: ${{ inputs.project-name }}-build-${{ inputs.workflow-id || github.run_id }} + path: ./boot/${{ inputs.project-name }}/build/libs - name: Configure AWS credentials For ECR and Secrets Manager uses: aws-actions/configure-aws-credentials@v1 diff --git a/.github/workflows/gradle_build.yml b/.github/workflows/gradle_build.yml index 6f8dddab..ec53398d 100644 --- a/.github/workflows/gradle_build.yml +++ b/.github/workflows/gradle_build.yml @@ -7,6 +7,10 @@ on: required: true type: string description: 'The name of the project to build' + workflow-id: + required: false + type: string + description: 'Workflow run ID for artifact naming' outputs: build-success: description: "빌드 성공 여부" @@ -20,7 +24,9 @@ jobs: steps: - name: Checkout code - uses: actions/checkout@v2 + uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup JDK 21 uses: actions/setup-java@v3 @@ -60,5 +66,6 @@ jobs: if: ${{ inputs.project-name != 'ALL' }} uses: actions/upload-artifact@v4 with: - name: ${{ inputs.project-name }}-build + name: ${{ inputs.project-name }}-build-${{ inputs.workflow-id || github.run_id }} path: ./boot/${{ inputs.project-name }}/build/libs + retention-days: 1