Deploying HydePHP with GitHub Actions
ยท Scott Cottam
Now that the site is a static HydePHP build, deploying it is just a case of copying files to a web server. I wanted that to happen on its own whenever I merge a change, without ever having to FTP anything by hand, so the whole thing runs from a single GitHub Actions workflow.
One build, two paths
Every run starts the same way: install the Composer and npm dependencies, compile the assets with Vite, run php hyde build, then zip up the _site folder. What happens next depends on why the workflow ran.
- Pull request opened or updated: the build is handed to the deploy job as a short-lived artifact, and rsync runs with
--dry-run. That checks the SSH connection still works and lists exactly which files would change on the server, without writing anything. - Pull request merged into main: the build is published as a GitHub release and then deployed for real.
Dated releases
Each deploy is tagged with the UTC date, so a release made today is 2026.11.30. A second release on the same day becomes 2026.11.30.1, and so on. The zipped site is attached to the release, which means every version that has ever been live is sitting on GitHub, and the deploy job always ships the exact zip that was released rather than rebuilding it.
Getting it onto DreamHost
The site is hosted on DreamHost shared hosting, so the deploy is plain rsync over SSH. A few details keep it safe:
- Pinned host keys. The server's host key is stored as a secret rather than fetched at deploy time, so a spoofed server gets rejected.
- A login test first. The job logs in once before touching any files, and prints just the authentication lines if DreamHost refuses the key.
- Careful
--delete. Files that are no longer in the build are removed, but DreamHost's own files and the Let's Encrypt.well-knownfolder are protected, and the target directory has to be a folder inside the home directory. - One deploy at a time. Real deploys queue rather than overlap, so the server always ends up on the latest release.
Small fixes along the way
Hyde doesn't copy dotfiles into the build, so the workflow adds the Apache .htaccess (which gives the site its pretty URLs) after hyde build runs. It's the kind of thing you only notice once the site is live and every link ends in .html.
The end result is that publishing a post, like this one, is just merging a pull request.