From 8796e8f40ffe2244af310435cf45e99e08620d6f Mon Sep 17 00:00:00 2001 From: Jaehyun Ahn <91878695+uwoobeat@users.noreply.github.com> Date: Mon, 12 Feb 2024 01:17:56 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20=EB=8F=84=EC=BB=A4=ED=97=88=EB=B8=8C?= =?UTF-8?q?=EC=97=90=20=EC=98=AC=EB=9D=BC=EA=B0=84=20=EC=9D=B4=EB=AF=B8?= =?UTF-8?q?=EC=A7=80=EB=A5=BC=20=EC=9E=AC=EB=B0=B0=ED=8F=AC=ED=95=98?= =?UTF-8?q?=EB=8A=94=20=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=EC=9A=B0=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80=20(#56)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * chore: deploy 전용 워크플로우 작성 * fix: 오타 수정 --- .github/workflows/develop_deploy.yml | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/develop_deploy.yml diff --git a/.github/workflows/develop_deploy.yml b/.github/workflows/develop_deploy.yml new file mode 100644 index 000000000..395e9ecc0 --- /dev/null +++ b/.github/workflows/develop_deploy.yml @@ -0,0 +1,29 @@ +name: Deploy to Develop + +on: + workflow_dispatch: + inputs: + commit_hash: + description: 'commit_hash' + required: true + +jobs: + deploy: + runs-on: ubuntu-latest + environment: develop + steps: + - name: Deploy to EC2 Server + uses: appleboy/ssh-action@master + env: + DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} + DOCKERHUB_IMAGE_TAG: ${{ github.event.inputs.commit_hash }} + with: + host: ${{ secrets.EC2_HOST }} + username: ${{ secrets.EC2_USERNAME }} + key: ${{ secrets.EC2_PRIVATE_KEY }} + envs: DOCKERHUB_USERNAME,DOCKERHUB_IMAGE_TAG # docker-compose.yml 에서 사용할 환경 변수 + script: | + echo "${{ secrets.DOCKERHUB_TOKEN }}" | docker login -u "${{ secrets.DOCKERHUB_USERNAME }}" --password-stdin + docker pull ${{ env.DOCKERHUB_USERNAME }}/gdsc-server:${{ env.DOCKERHUB_IMAGE_TAG }} + docker compose -f /home/ubuntu/docker-compose.yml up -d + docker image prune -a -f