Skip to content

Commit 8735fa0

Browse files
authored
Update deploy.yml
1 parent 5ca08ef commit 8735fa0

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
# GitHub Actions Workflow for Deploying Website
2+
13
name: Deploy Website
24

35
on:
@@ -14,14 +16,10 @@ jobs:
1416

1517
- name: Set up SSH Agent
1618
run: |
17-
eval "$(ssh-agent -s)"
18-
echo "${{ secrets.DEPLOY_KEY }}" | tr -d '\r' | ssh-add -
19-
ssh-keyscan -t rsa github.com >> ~/.ssh/known_hosts
20-
ssh-add -l
21-
echo "SSH key added successfully."
22-
23-
- name: Verify SSH Connection
24-
run: ssh -o StrictHostKeyChecking=no -T git@github.com || exit 1
19+
eval "$(ssh-agent -s)" # Start SSH agent
20+
echo "${{ secrets.DEPLOY_KEY }}" | ssh-add - # Add private key
21+
env:
22+
DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
2523

2624
- name: Deploy to Namecheap Server
2725
uses: appleboy/ssh-action@v0.1.4
@@ -31,6 +29,8 @@ jobs:
3129
username: ${{ secrets.SERVER_USERNAME }}
3230
key: ${{ secrets.DEPLOY_KEY }}
3331
script: |
32+
eval "$(ssh-agent -s)"
33+
ssh-add ~/.ssh/new_repo_key
3434
cd ~/public_html/
3535
git pull origin main
3636
echo "Deployment successful!"

0 commit comments

Comments
 (0)