-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
95aac3e
commit 5c31735
Showing
1 changed file
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |