cpanel-deploy

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/
Highlighted: what changes per project, and what you paste into Settings, Secrets, Actions.

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.

  1. Choose the account

    Pick a saved cPanel account or add one. The login is tested right away.

  2. Choose the branch

    Pushes to this branch deploy. A manual run button is added too.

  3. Browse the server

    Click through folders like public_html/live, or create a new one.

  4. Confirm build steps

    composer install, npm run build, and what to skip like .env and node_modules.

  5. 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.

CommandWhat it does
npx cpanel-deploy initSets up deploys for the repo you are in. Run it again to add a second target, like staging next to live.
npx cpanel-deploy profilesAdd, edit, test or delete your saved cPanel accounts.
npx cpanel-deploy secretsUploads the secrets again after you change an FTP password or move hosts.
npx cpanel-deploy doctorChecks 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.

Next project, one command.