From b4d6bf3d276bd1fb8a50e9ef46f370ee07590c1d Mon Sep 17 00:00:00 2001 From: seoiiwon Date: Sun, 17 Aug 2025 17:15:01 +0900 Subject: [PATCH] =?UTF-8?q?=E2=9A=99=EF=B8=8F=20Fix:=20"Github=20Actions?= =?UTF-8?q?=20=EC=88=98=EC=A0=95"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Github Actions 배포 자동화 env 수정 related to: #19 --- .github/workflows/release-deploy.yml | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/.github/workflows/release-deploy.yml b/.github/workflows/release-deploy.yml index 761ffc8..a9e0697 100644 --- a/.github/workflows/release-deploy.yml +++ b/.github/workflows/release-deploy.yml @@ -7,9 +7,8 @@ on: env: AWS_REGION: us-west-2 - ACCOUNT_ID: 590184104064 + ACCOUNT_ID: "590184104064" ECR_REPOSITORY: popcong-server - REGISTRY: ${{ env.ACCOUNT_ID }}.dkr.ecr.${{ env.AWS_REGION }}.amazonaws.com IMAGE_TAG: ${{ github.sha }} concurrency: @@ -23,6 +22,13 @@ jobs: id-token: write contents: read + env: + AWS_REGION: ${{ env.AWS_REGION }} + ACCOUNT_ID: ${{ env.ACCOUNT_ID }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + IMAGE_TAG: ${{ env.IMAGE_TAG }} + REGISTRY: ${{ format('{0}.dkr.ecr.{1}.amazonaws.com', env.ACCOUNT_ID, env.AWS_REGION) }} + steps: - name: Checkout uses: actions/checkout@v4 @@ -56,6 +62,12 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 15 + env: + AWS_REGION: ${{ env.AWS_REGION }} + ACCOUNT_ID: ${{ env.ACCOUNT_ID }} + ECR_REPOSITORY: ${{ env.ECR_REPOSITORY }} + REGISTRY: ${{ format('{0}.dkr.ecr.{1}.amazonaws.com', env.ACCOUNT_ID, env.AWS_REGION) }} + steps: - name: Connect & Deploy on EC2 uses: appleboy/ssh-action@v1.2.0 @@ -66,10 +78,6 @@ jobs: script: | set -euo pipefail - AWS_REGION="${{ env.AWS_REGION }}" - ACCOUNT_ID="${{ env.ACCOUNT_ID }}" - REGISTRY="${ACCOUNT_ID}.dkr.ecr.${AWS_REGION}.amazonaws.com" - echo "[EC2] ECR 로그인" aws ecr get-login-password --region "$AWS_REGION" | docker login --username AWS --password-stdin "$REGISTRY"