68 lines
1.8 KiB
YAML
68 lines
1.8 KiB
YAML
# Example workflow demonstrating the setup-ssh-client action
|
|
|
|
name: Deploy Example
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
deploy-with-shell-wrapper:
|
|
name: Deploy using ssh-remote shell
|
|
if: always() == 'false'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH
|
|
uses: ./
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
ssh-host: ${{ secrets.SSH_HOST }}
|
|
ssh-user: ${{ secrets.SSH_USER }}
|
|
|
|
- name: Check system info
|
|
shell: ssh-remote
|
|
run: |
|
|
echo "=== System Information ==="
|
|
whoami
|
|
hostname
|
|
uname -a
|
|
pwd
|
|
|
|
- name: Run deployment script
|
|
shell: ssh-remote
|
|
run: |
|
|
echo "=== Starting Deployment ==="
|
|
cd /var/www || cd ~
|
|
|
|
# Example deployment commands
|
|
echo "Current directory: $(pwd)"
|
|
echo "Disk usage:"
|
|
df -h | head -n 5
|
|
|
|
echo "✅ Deployment completed"
|
|
|
|
deploy-direct-ssh:
|
|
name: Deploy using direct SSH
|
|
if: always() == 'false'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup SSH (without shell wrapper)
|
|
uses: ./
|
|
with:
|
|
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
|
ssh-host: ${{ secrets.SSH_HOST }}
|
|
ssh-user: ${{ secrets.SSH_USER }}
|
|
use-shell-wrapper: 'false'
|
|
|
|
- name: Run direct SSH commands
|
|
run: |
|
|
echo "Running remote commands via SSH..."
|
|
ssh github-action-host "whoami"
|
|
ssh github-action-host "pwd"
|
|
ssh github-action-host "uname -a"
|