Add deploy-asp-net-core.yml

This commit is contained in:
2026-05-26 07:34:17 +00:00
parent f04defd62d
commit 6cd4c23c6b
+50
View File
@@ -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 }}