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