From 74bb017dc57468d7b82c5ff64ffac7ed3d5aec62 Mon Sep 17 00:00:00 2001 From: flydog98 Date: Mon, 18 Dec 2023 20:39:34 +0900 Subject: [PATCH] =?UTF-8?q?fix:=20github=20=ED=99=98=EA=B2=BD=20=EB=B3=80?= =?UTF-8?q?=EC=88=98=20=EB=B3=80=EA=B2=BD=20=EB=B0=8F=20backend=5Fssh=5Fus?= =?UTF-8?q?ername=20=EC=82=AC=EC=9A=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit [#300] --- .github/workflows/backend-deploy.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/backend-deploy.yml b/.github/workflows/backend-deploy.yml index 5f09846..2a4b3b5 100644 --- a/.github/workflows/backend-deploy.yml +++ b/.github/workflows/backend-deploy.yml @@ -68,7 +68,7 @@ jobs: port: ${{ secrets.NGINX_SSH_PORT }} script: | CURRENT_STATE=$(cat /status) - echo "CURRENT_STATE=$CURRENT_STATE" >> $GITHUB_ENV + echo "::set-output name=CURRENT_STATE::$CURRENT_STATE" - name: SSH and Deploy uses: appleboy/ssh-action@master @@ -78,11 +78,11 @@ jobs: password: ${{ secrets.BACKEND_SSH_PASSWORD }} port: ${{ secrets.BACKEND_SSH_PORT }} script: | - echo "The current state is ${{ env.CURRENT_STATE }}" + echo "The current state is ${{ steps.get-state.outputs.CURRENT_STATE }}" docker pull ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1 - if [ ${{ env.CURRENT_STATE }} = "blue" ]; then + if [ ${{ steps.get-state.outputs.CURRENT_STATE }} = "blue" ]; then docker run -d --name backend-blue -p 8081:8080 \ - -v /${{ secrets.CONTAINER_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \ + -v /${{ secrets.BACKEND_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \ -e CONTAINER_GIT_USERNAME=${{ secrets.CONTAINER_GIT_USERNAME }} \ -e MONGODB_HOST=${{ secrets.MONGODB_HOST }} \ -e SECRET_KEY=${{ secrets.SECRET_KEY }} \ @@ -92,11 +92,11 @@ jobs: -e CONTAINER_SERVER_HOST=${{ secrets.CONTAINER_SERVER_HOST }} \ -e CONTAINER_POOL_MAX=${{ secrets.CONTAINER_POOL_MAX }} \ ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1 - docker rm -f backend-blue || true + docker rm -f backend-green || true echo "green" > /status else docker run -d --name backend-green -p 8080:8080 \ - -v /${{ secrets.CONTAINER_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \ + -v /${{ secrets.BACKEND_SSH_USERNAME }}/backend-logs:/app/packages/backend/logs/ \ -e CONTAINER_GIT_USERNAME=${{ secrets.CONTAINER_GIT_USERNAME }} \ -e MONGODB_HOST=${{ secrets.MONGODB_HOST }} \ -e SECRET_KEY=${{ secrets.SECRET_KEY }} \ @@ -106,7 +106,7 @@ jobs: -e CONTAINER_SERVER_HOST=${{ secrets.CONTAINER_SERVER_HOST }} \ -e CONTAINER_POOL_MAX=${{ secrets.CONTAINER_POOL_MAX }} \ ${{ secrets.DOCKERHUB_USERNAME }}/git-challenge-backend:0.1 - docker rm -f backend-green || true + docker rm -f backend-blue || true echo "blue" > /status fi