From 034f72081e05735302e163184db3b42b24d8f99d Mon Sep 17 00:00:00 2001 From: skywalker Date: Mon, 22 Jul 2024 17:32:50 +0300 Subject: [PATCH 1/4] chore(cd): show port that passing through to SSH connection --- .github/workflows/cicd.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index a8abffde..2902982a 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -137,6 +137,8 @@ jobs: docker rmi -f "$image_id"; done + echo "Dev port: $DEV_PORT" + docker run -d -p $DEV_PORT:8080 "myshx/muse-server:dev-$GIT_COMMIT_SHA" deploy-staging: From 3090f6b7723e8fe79b7db5f969741427ce24728c Mon Sep 17 00:00:00 2001 From: skywalker Date: Mon, 22 Jul 2024 17:39:23 +0300 Subject: [PATCH 2/4] fix(cd): use `${{ env.*_PORT }}` instead of `$*_PORT` --- .github/workflows/cicd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index 2902982a..abf5fd66 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -111,7 +111,7 @@ jobs: uses: appleboy/ssh-action@v1.0.3 env: GIT_COMMIT_SHA: ${{ github.sha }} - DEV_PORT: $DEV_PORT + DEV_PORT: ${{ env.DEV_PORT }} with: host: ${{ secrets.SERVER_HOST }} username: ${{ secrets.SERVER_USERNAME }} @@ -174,7 +174,7 @@ jobs: uses: appleboy/ssh-action@v1.0.3 env: GIT_COMMIT_SHA: ${{ github.sha }} - STAGING_PORT: $STAGING_PORT + STAGING_PORT: ${{ env.STAGING_PORT }} with: host: ${{ secrets.SERVER_HOST }} username: ${{ secrets.SERVER_USERNAME }} @@ -234,7 +234,7 @@ jobs: uses: appleboy/ssh-action@v1.0.3 env: GIT_COMMIT_SHA: ${{ github.sha }} - PROD_PORT: $PROD_PORT + PROD_PORT: ${{ env.PROD_PORT }} with: host: ${{ secrets.SERVER_HOST }} username: ${{ secrets.SERVER_USERNAME }} From fce401f69e10d2b5643ada038ce2d97bd17c2cb7 Mon Sep 17 00:00:00 2001 From: skywalker Date: Mon, 22 Jul 2024 17:45:13 +0300 Subject: [PATCH 3/4] fix(cd): pass to `envs:` (appleboy ssh action field) port parameter --- .github/workflows/cicd.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index abf5fd66..c3d53812 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -117,7 +117,7 @@ jobs: username: ${{ secrets.SERVER_USERNAME }} password: ${{ secrets.SERVER_PASSWORD }} port: ${{ secrets.SERVER_PORT }} - envs: GIT_COMMIT_SHA + envs: GIT_COMMIT_SHA, DEV_PORT script: | export GIT_COMMIT_SHA=$GIT_COMMIT_SHA export DEV_PORT=$DEV_PORT @@ -180,7 +180,7 @@ jobs: username: ${{ secrets.SERVER_USERNAME }} password: ${{ secrets.SERVER_PASSWORD }} port: ${{ secrets.SERVER_PORT }} - envs: GIT_COMMIT_SHA + envs: GIT_COMMIT_SHA, STAGING_PORT script: | export GIT_COMMIT_SHA=$GIT_COMMIT_SHA export STAGING_PORT=$STAGING_PORT @@ -240,7 +240,7 @@ jobs: username: ${{ secrets.SERVER_USERNAME }} password: ${{ secrets.SERVER_PASSWORD }} port: ${{ secrets.SERVER_PORT }} - envs: GIT_COMMIT_SHA + envs: GIT_COMMIT_SHA, PROD_PORT script: | export GIT_COMMIT_SHA=$GIT_COMMIT_SHA export PROD_PORT=$PROD_PORT From 9fe42b5f74f87b2f0a590e53ba709f7854764ff1 Mon Sep 17 00:00:00 2001 From: skywalker Date: Mon, 22 Jul 2024 17:53:10 +0300 Subject: [PATCH 4/4] chore(cd): problem fixed, removed debug logging --- .github/workflows/cicd.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/cicd.yml b/.github/workflows/cicd.yml index c3d53812..c0ae3f13 100644 --- a/.github/workflows/cicd.yml +++ b/.github/workflows/cicd.yml @@ -137,8 +137,6 @@ jobs: docker rmi -f "$image_id"; done - echo "Dev port: $DEV_PORT" - docker run -d -p $DEV_PORT:8080 "myshx/muse-server:dev-$GIT_COMMIT_SHA" deploy-staging: