-
-
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/ |
Thank you for your suggestion, but this solution doesn't align with my goals. This script would completely replace all files on the remote server and delete any other files or folders that are not included in the local repository. However, I need to retain some files and folders on the remote server and do not want them to be removed each time I perform a pull.
Thank you for your suggestion, but this solution doesn't align with my goals. This script would completely replace all files on the remote server and delete any other files or folders that are not included in the local repository. However, I need to retain some files and folders on the remote server and do not want them to be removed each time I perform a pull.
Hi @PaulAsaf2,
To do this, you need to use rsync options.
For example, adding "rsync-options: --archive" to the end of the .yml file will prevent any files from being deleted.
See the examples provided by SamKirkland (https://github.com/SamKirkland/web-deploy) and the rsync documentation (https://linux.die.net/man/1/rsync).
Hi @tneelis-swh,
as I can see you are using ED25519 for key-encryption. Try using exactly the mentioned
ssh-keygen -m PEM -t rsa -b 4096for your keys. According to the comments on #SamKirkland/web-deploy#22 PEM is required to have it working.I had the same issue and this fixed it for me.