24 lines
1 KiB
YAML
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
|