Skip to content

Commit

Permalink
testing
Browse files Browse the repository at this point in the history
  • Loading branch information
vmvartiainen committed Sep 13, 2024
1 parent 95aac3e commit 5c31735
Showing 1 changed file with 58 additions and 0 deletions.
58 changes: 58 additions & 0 deletions .github/workflows/compare_files_over_ssh.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Configure SSH
on: [workflow_dispatch]

jobs:
SSH_Configuration:
runs-on: ubuntu-latest

env:
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
LOCAL_PATH: ${{ secrets.LOCAL_PATH }}
REMOTE_PATH: ${{ secrets.REMOTE_PATH }}
SSH_KEY: ${{ secrets.REMOTE_KEY }}

steps:
- name: Checkout Repository
uses: actions/[email protected]
with:
sparse-checkout: |
compare
sparse-checkout-cone-mode: false

- name: Configure SSH
run: |
mkdir -p ~/.ssh/
echo "${{ env.SSH_KEY }}" | tr -d '\r' > ~/.ssh/remote_key
echo "Checking permissions of remote_key before"
ls -l ~/.ssh/remote_key
echo "Changing permissions of remote_key"
chmod 600 ~/.ssh/remote_key
echo "Checking permissions of remote_key after the change"
ls -l ~/.ssh/remote_key
cat >>~/.ssh/config <<END
Host test_env
HostName $REMOTE_HOST
User $REMOTE_USER
IdentityFile ~/.ssh/remote_key
StrictHostKeyChecking no
END
echo "Checking contents of SSH configuration file"
echo "---"
cat ~/.ssh/config
echo "---"
echo "SSH configuration completed successfully."
ls -la ~/.ssh/
- name: Copy files from Remote to GH Actions runner
run: |
echo "Starting to copy files from remote to GH Actions runner"
ssh -tt test_env << 'EOF'
echo "SSH Connection Successful"
cd /var/www/compare/
ls -la
#sscp -r $REMOTE_PATH $LOCAL_PATH
exit
EOF

0 comments on commit 5c31735

Please sign in to comment.