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