From 61b0f41de6fb533c04da32be2a2ed2e027f17b14 Mon Sep 17 00:00:00 2001 From: withsang Date: Sun, 17 Sep 2023 04:46:45 +0900 Subject: [PATCH] feat(docker): add cd to dev --- .../{dev-cd.yaml => dev-build-image.yaml} | 0 .github/workflows/dev-deploy.yaml | 31 +++++++++++++++++++ 2 files changed, 31 insertions(+) rename .github/workflows/{dev-cd.yaml => dev-build-image.yaml} (100%) create mode 100644 .github/workflows/dev-deploy.yaml diff --git a/.github/workflows/dev-cd.yaml b/.github/workflows/dev-build-image.yaml similarity index 100% rename from .github/workflows/dev-cd.yaml rename to .github/workflows/dev-build-image.yaml diff --git a/.github/workflows/dev-deploy.yaml b/.github/workflows/dev-deploy.yaml new file mode 100644 index 0000000..0d2d471 --- /dev/null +++ b/.github/workflows/dev-deploy.yaml @@ -0,0 +1,31 @@ +name: Deploy to dev server + +# when dev image build action is completed, run this action +on: + workflow_run: + workflows: ["Build docker image on push to develop"] + types: + - completed + +jobs: + if_workflow_success: + name: Deploy to dev server + runs-on: ubuntu-latest + if: ${{ github.event.workflow_run.conclusion == 'success' }} + + steps: + - name: executing remote ssh commands using password + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.HOST }} + port: ${{ secrets.PORT }} + username: ${{ secrets.USERNAME }} + password: ${{ secrets.PASSWORD }} + proxy_host: ${{ secrets.PROXY_HOST }} + proxy_port: ${{ secrets.PROXY_PORT }} + proxy_username: ${{ secrets.PROXY_USERNAME }} + proxy_password: ${{ secrets.PROXY_PASSWORD }} + script: | + docker pull ghcr.io/sparcs-kaist/zabo-front:dev + docker rm -f zabo-front + docker run --restart always -d -p 15081:80 --name zabo-front ghcr.io/sparcs-kaist/zabo-front:dev