Deploying automatically when code is pushed.
HOW IT WORKS
Your repository host runs a pipeline on each push. The pipeline connects to the server and runs your deployment steps.
Alternatively, a webhook calls a script on your server.
WHAT YOU NEED
SSH access to the server A deploy key or credentials the pipeline can use, stored as secrets rather than in the repository A reliable deployment script Ideally, tests that run before deployment
DEPLOY ON WHICH BRANCH
Deploy from a branch representing production, not from every push to every branch. A main or production branch that is deployed, and feature branches that are not, is the usual arrangement.
SECURITY
The pipeline holds credentials to your server. Use a restricted key, limited to what deployment needs.
Never put credentials in the repository, even a private one.
WHETHER YOU NEED THIS
For a site deployed monthly, manual deployment is simpler and adequate. For a site deployed several times a week, automation pays for itself quickly.
Start manual, automate when the friction justifies it.