forgejo-workflow-templates/dotnet-systemd-ssh.yml
gergoantos 34c153bcb9 a
2026-05-26 14:59:34 +02:00

24 lines
1 KiB
YAML

on:
workflow_call:
inputs:
project_path: { required: true, type: string } # e.g. Backend/EZLineGo
env: { required: true, type: string } # prod | stage
ssh_user: { required: true, type: string }
ssh_host: { required: true, type: string }
stamp: { required: true, type: string }
secrets:
SSH_KEY: { required: true }
jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: dotnet publish ${{ inputs.project_path }} -c Release -r linux-x64 --no-self-contained -o publish
- run: cd publish && zip -rq ../payload.zip .
- name: Add SSH key
run: |
mkdir -p ~/.ssh && chmod 700 ~/.ssh
echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519 && chmod 600 ~/.ssh/id_ed25519
ssh-keyscan -H ${{ inputs.ssh_host }} >> ~/.ssh/known_hosts
- run: |
scp payload.zip ${{ inputs.ssh_user }}@${{ inputs.ssh_host }}:/tmp/${{ inputs.stamp }}-$(basename ${{ inputs.project_path }}).zip