Skip to content

Instantly share code, notes, and snippets.

@LearnWebCode
Created January 15, 2025 20:02
Show Gist options
  • Save LearnWebCode/09a0606345bcad8b264e0fedb0b69c50 to your computer and use it in GitHub Desktop.
Save LearnWebCode/09a0606345bcad8b264e0fedb0b69c50 to your computer and use it in GitHub Desktop.
name: Publish Website
on:
push:
branches:
- main
jobs:
web-deploy:
name: πŸš€ Deploy Website Every Commit
runs-on: ubuntu-latest
steps:
- name: 🚚 Get Latest Code
uses: actions/checkout@v3
- name: πŸ“‚ Sync Files
uses: SamKirkland/web-deploy@v1
with:
target-server: live.learnwebcode.com
remote-user: youruser
private-ssh-key: ${{ secrets.SSH_KEY }}
destination-path: /home/youruser/live.learnwebcode.com/wp-content/themes/my-awesome-theme/
@VietAnhPhan
Copy link

Thanks!

@tneelis-swh
Copy link

I used ftp and everything works fine but I cannot for the life of me figure out the ssh

Log of github action:

HOME /home/runner
GITHUB_WORKSPACE /home/runner/work/mywebsite
[SSH] Creating /home/runner/.ssh/known_hosts file in /home/runner/work/mywebsite
βœ… [SSH] file created.
βœ… Ssh key added to .ssh dir /home/runner/.ssh/web_deploy_key
/usr/bin/rsync -e ssh -p 22 -i /home/runner/.ssh/web_deploy_key -o StrictHostKeyChecking=no --archive --verbose --compress --human-readable --progress --delete-after --exclude=.git* --exclude=.git/ --exclude=README.md --exclude=readme.md --exclude=.gitignore ./ [email protected]:/public_html/wp-content/themes/wp-theme/
<Buffer 57 61 72 6e 69 6e 67 3a 20 50 65 72 6d 61 6e 65 6e 74 6c 79 20 61 64 64 65 64 20 27 6e 6f 64 65 31 35 2e 6d 79 66 63 6c 6f 75 64 63 68 2e 63 6f 6d 27 ... 40 more bytes>
Warning: Permanently added 'myserverexample.com' (ED25519) to the list of known hosts.
<Buffer 50 65 72 6d 69 73 73 69 6f 6e 20 64 65 6e 69 65 64 2c 20 70 6c 65 61 73 65 20 74 72 79 20 61 67 61 69 6e 2e 0d 0a>
Permission denied, please try again.
<Buffer 50 65 72 6d 69 73 73 69 6f 6e 20 64 65 6e 69 65 64 2c 20 70 6c 65 61 73 65 20 74 72 79 20 61 67 61 69 6e 2e 0d 0a>
Permission denied, please try again.
<Buffer 73 74 61 67 69 6e 67 76 61 63 6c 61 69 6d 73 69 40 6e 6f 64 65 31 35 2e 6d 79 66 63 6c 6f 75 64 63 68 2e 63 6f 6d 3a 20 50 65 72 6d 69 73 73 69 6f 6e ... 60 more bytes>
[email protected]: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
<Buffer 72 73 79 6e 63 3a 20 63 6f 6e 6e 65 63 74 69 6f 6e 20 75 6e 65 78 70 65 63 74 65 64 6c 79 20 63 6c 6f 73 65 64 20 28 30 20 62 79 74 65 73 20 72 65 63 ... 93 more bytes>
rsync: connection unexpectedly closed (0 bytes received so far) [sender]
rsync error: unexplained error (code 255) at io.c(232) [sender=3.2.7]
Error: Error: The process '/usr/bin/rsync' failed with exit code 255
βœ… Deploy Complete

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment