feat: initial release — Setup SSH Client GitHub Action\n\nInitial implementation of the action to configure an SSH client and an optional remote shell wrapper.\n- Creates ~/.ssh, adds identity and known_hosts\n- Adds ssh config for 'github-action-host'\n- Optional SSH remote shell wrapper using mktemp\n- Fails when strict-host-key-checking is 'yes' and no hosts are provided\n\nThis is the initial creation of the action.,
This commit is contained in:
commit
a5027e414c
5 changed files with 518 additions and 0 deletions
68
.github/workflows/example.yml
vendored
Normal file
68
.github/workflows/example.yml
vendored
Normal file
|
|
@ -0,0 +1,68 @@
|
|||
# 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"
|
||||
Loading…
Add table
Add a link
Reference in a new issue