From 99b9a55fdd67096996ff175355d30778c85c1d27 Mon Sep 17 00:00:00 2001 From: DongkyunKim <134477764+dongkyun0713@users.noreply.github.com> Date: Thu, 18 Jul 2024 01:28:12 +0900 Subject: [PATCH] =?UTF-8?q?Refactor(#14):=20deploy=5Fproduction.yml=20?= =?UTF-8?q?=EC=88=98=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/deploy_production.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/deploy_production.yml b/.github/workflows/deploy_production.yml index 49e783cc..21523399 100644 --- a/.github/workflows/deploy_production.yml +++ b/.github/workflows/deploy_production.yml @@ -58,24 +58,24 @@ jobs: - name: Determine Active Environment id: determine-env run: | - if [ "${{ secrets.CURRENT_CONTAINER }}" == "${{ secrets.CONTAINER_NAME_BLUE }}" ]; then - echo "NEW_CONTAINER=${{ secrets.CONTAINER_NAME_GREEN }}" >> $GITHUB_ENV + if [ "${{ env.CURRENT_CONTAINER }}" == "${{ env.CONTAINER_NAME_BLUE }}" ]; then + echo "NEW_CONTAINER=${{ env.CONTAINER_NAME_GREEN }}" >> $GITHUB_ENV echo "NEW_PORT=8088" >> $GITHUB_ENV else - echo "NEW_CONTAINER=${{ secrets.CONTAINER_NAME_BLUE }}" >> $GITHUB_ENV + echo "NEW_CONTAINER=${{ env.CONTAINER_NAME_BLUE }}" >> $GITHUB_ENV echo "NEW_PORT=8087" >> $GITHUB_ENV fi - name: Deploy to EC2 uses: appleboy/ssh-action@master with: - host: ${{ secrets.EC2_HOST }} - username: ${{ secrets.EC2_SSH_USER }} - key: ${{ secrets.EC2_SSH_PRIVATE_KEY }} + host: ${{ env.EC2_HOST }} + username: ${{ env.EC2_SSH_USER }} + key: ${{ env.EC2_SSH_PRIVATE_KEY }} script: | - CURRENT_CONTAINER=${{ secrets.CURRENT_CONTAINER }} + CURRENT_CONTAINER=${{ env.CURRENT_CONTAINER }} NEW_CONTAINER=${{ env.NEW_CONTAINER }} - CURRENT_PORT=${{ secrets.CURRENT_PORT }} + CURRENT_PORT=${{ env.CURRENT_PORT }} NEW_PORT=${{ env.NEW_PORT }} if [ $(sudo docker ps -q -f name=$NEW_CONTAINER) ]; then @@ -88,3 +88,4 @@ jobs: echo "CURRENT_CONTAINER=$NEW_CONTAINER" >> $GITHUB_ENV echo "CURRENT_PORT=$NEW_PORT" >> $GITHUB_ENV +