initial: ssh-deploy composite action

This commit is contained in:
2026-07-30 22:20:58 +02:00
parent 0e27f2d2fe
commit ac8f1adbef
+72
View File
@@ -0,0 +1,72 @@
name: 'SSH Deploy'
description: 'SSH to remote host and run the deploy script for a given stack'
inputs:
deploy_host:
description: 'Remote host to deploy to'
required: true
deploy_user:
description: 'SSH user on remote host'
required: true
deploy_ssh_key:
description: 'SSH private key for authentication'
required: true
deploy_known_hosts:
description: 'SSH known_hosts entry for the remote host'
required: true
stack:
description: 'Stack name to deploy (e.g. paper-trading)'
required: true
deploy_tag:
description: 'Tag/branch name for notification messages'
required: false
default: ''
ntfy_topic:
description: 'ntfy topic for deploy success notification'
required: false
default: ''
ntfy_token:
description: 'ntfy token for deploy success notification'
required: false
default: ''
ntfy_failure_topic:
description: 'ntfy topic for deploy failure notification (defaults to ntfy_topic)'
required: false
default: ''
ntfy_failure_token:
description: 'ntfy token for deploy failure notification (defaults to ntfy_token)'
required: false
default: ''
runs:
using: "composite"
steps:
- name: Configure SSH & Deploy
shell: bash
run: |
mkdir -p ~/.ssh
echo "${{ inputs.deploy_ssh_key }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
echo "${{ inputs.deploy_known_hosts }}" > ~/.ssh/known_hosts
chmod 600 ~/.ssh/known_hosts
ssh -i ~/.ssh/deploy_key \
"${{ inputs.deploy_user }}@${{ inputs.deploy_host }}" \
"${{ inputs.stack }}"
- name: Notify Deploy Success
if: success() && inputs.ntfy_topic != ''
uses: https://lab.zlymeda.dynu.net/actions/ntfy-notify@main
with:
ntfy_topic: ${{ inputs.ntfy_topic }}
ntfy_token: ${{ inputs.ntfy_token }}
status: success
message: 🚀 ${{ inputs.stack }} deployed${{ inputs.deploy_tag && format(' ({0})', inputs.deploy_tag) || '' }}
- name: Notify Deploy Failure
if: failure()
uses: https://lab.zlymeda.dynu.net/actions/ntfy-notify@main
with:
ntfy_topic: ${{ inputs.ntfy_failure_topic || inputs.ntfy_topic }}
ntfy_token: ${{ inputs.ntfy_failure_token || inputs.ntfy_token }}
status: failure
message: Deploy failed (${{ inputs.stack }})${{ inputs.deploy_tag && format(' ({0})', inputs.deploy_tag) || '' }}