Push to GitHub. Land on cPanel.
One command sets up the GitHub Actions deploy, tests your FTP login and uploads the secrets for you.
Run it inside your project folder. Needs Node 20.12 or newer.
The file you copy into every project
Same workflow, a few paths changed, then three secrets typed into GitHub by hand. Every repo, every time.
name: Deploy to cPanel
on:
push:
branches:
- cp-live
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy via FTP to cPanel
uses: SamKirkland/[email protected]
with:
server: ${{ secrets.CPANEL_HOST }}
username: ${{ secrets.CPANEL_USERNAME }}
password: ${{ secrets.CPANEL_PASSWORD }}
local-dir: ./
server-dir: public_html/
With cpanel-deploy
- Save each cPanel account onceThen pick it from a list in every new repo.
- Pick the folder, don't guess itIt logs in over FTP and lets you browse to the right place.
- Secrets go up on their ownThrough the GitHub CLI, or a token you paste once.
- Laravel and Vite builds includedSpots composer.json and a build script and adds those steps.
What happens when you run it
About a minute, start to finish. Nothing is written until you confirm the summary.
Choose the account
Pick a saved cPanel account or add one. The login is tested right away.
Choose the branch
Pushes to this branch deploy. A manual run button is added too.
Browse the server
Click through folders like public_html/live, or create a new one.
Confirm build steps
composer install, npm run build, and what to skip like .env and node_modules.
Write and upload
The workflow is written, secrets uploaded, and the file committed. Push to ship.
Commands
Run without a command to get a menu.
| Command | What it does |
|---|---|
npx cpanel-deploy init | Sets up deploys for the repo you are in. Run it again to add a second target, like staging next to live. |
npx cpanel-deploy profiles | Add, edit, test or delete your saved cPanel accounts. |
npx cpanel-deploy secrets | Uploads the secrets again after you change an FTP password or move hosts. |
npx cpanel-deploy doctor | Checks Node, Git, the GitHub CLI and which repo you are in. |
Good to know
Where your passwords live
In ~/.cpanel-deploy/config.json on your own computer, readable only by your user. You can choose not to save a password and type it each time.
Use a separate FTP account
In cPanel, create an FTP account limited to the deploy folder. If the secret ever leaks, it can only touch that folder.
GitHub CLI or a token
If gh is logged in, secrets upload with no questions. Otherwise paste a fine grained token with Secrets read and write.
Certificate warnings
Shared hosts often use a certificate for the server hostname, not your domain. The tool explains this and can allow it for that account.
Only changed files upload
Deploys use FTP-Deploy-Action, which keeps a small state file on the server and sends only what changed.
Nothing to install on the server
Everything runs on GitHub's machines. Your hosting only needs FTP, which every cPanel plan has.