From 6cd4c23c6b606dbefcfc4d6ee5f053382d151fb6 Mon Sep 17 00:00:00 2001 From: ehsan-hrz Date: Tue, 26 May 2026 07:34:17 +0000 Subject: [PATCH] Add deploy-asp-net-core.yml --- deploy-asp-net-core.yml | 50 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) create mode 100644 deploy-asp-net-core.yml diff --git a/deploy-asp-net-core.yml b/deploy-asp-net-core.yml new file mode 100644 index 0000000..80129ca --- /dev/null +++ b/deploy-asp-net-core.yml @@ -0,0 +1,50 @@ +name: Reusable Deploy + +on: + workflow_call: + inputs: + image_ref: + required: true + type: string + + container_name: + required: true + type: string + + port: + required: true + type: string + + secrets: + SSH_HOST: + required: true + + SSH_USER: + required: true + + SSH_PRIVATE_KEY: + required: true + +jobs: + deploy: + runs-on: docker-build + + steps: + - name: Deploy + uses: appleboy/ssh-action@v1.2.0 + with: + host: ${{ secrets.SSH_HOST }} + username: ${{ secrets.SSH_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + + script: | + docker pull ${{ inputs.image_ref }} + + docker stop ${{ inputs.container_name }} || true + docker rm ${{ inputs.container_name }} || true + + docker run -d \ + --name ${{ inputs.container_name }} \ + --restart unless-stopped \ + -p ${{ inputs.port }} \ + ${{ inputs.image_ref }} \ No newline at end of file