From dc544dda15064f1d8fe92c57545ad0903fb09cbf Mon Sep 17 00:00:00 2001 From: kdomo Date: Fri, 19 Jan 2024 15:05:27 +0900 Subject: [PATCH] =?UTF-8?q?chore:=20production=20deploy=EC=9A=A9=20?= =?UTF-8?q?=EC=9B=8C=ED=81=AC=ED=94=8C=EB=A1=9C=20=EC=83=9D=EC=84=B1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/production_deploy.yml | 30 +++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 .github/workflows/production_deploy.yml diff --git a/.github/workflows/production_deploy.yml b/.github/workflows/production_deploy.yml new file mode 100644 index 000000000..2a9c2234e --- /dev/null +++ b/.github/workflows/production_deploy.yml @@ -0,0 +1,30 @@ +name: production Deploy + +on: + workflow_dispatch: + inputs: + version: + description: 'version' + required: true + +jobs: + deploy: + runs-on: ubuntu-latest + environment: PROD + steps: + - name: Deploy to NCP Server + uses: appleboy/ssh-action@master + env: + NCP_CONTAINER_REGISTRY: ${{ secrets.NCP_CONTAINER_REGISTRY }} + NCP_IMAGE_TAG: ${{ github.event.inputs.version }} + with: + host: ${{ secrets.NCP_HOST }} + username: tenminute + key: ${{ secrets.NCP_PRIVATE_KEY }} + port: ${{ secrets.NCP_PORT }} + envs: NCP_CONTAINER_REGISTRY,NCP_IMAGE_TAG # docker-compose.yml 에서 사용할 환경 변수 + script: | + echo "${{ secrets.NCP_SECRET_KEY }}" | docker login -u "${{ secrets.NCP_ACCESS_KEY }}" --password-stdin "${{ secrets.NCP_CONTAINER_REGISTRY }}" + docker pull ${{ secrets.NCP_CONTAINER_REGISTRY }}/server-spring:${{ github.event.inputs.version }} + docker compose -f /home/tenminute/docker-compose.yaml up -d + docker image prune -a -f \ No newline at end of file