A five-file Laravel release when the production worktree has drifted
On 5 October I shipped a design refresh to the storefront I run: one stylesheet and four Blade templates, the hero, catalog, operations and homepage views. Nothing else moved. No migrations, no seeding, no dependency changes, no database edits. The interesting part was not the design. It was that the production worktree was not in the state my branch said it should be in, and I did not want a…
On October 5th, a five-file Laravel release took place when the production worktree had diverged from the branch being worked on. The update consisted of one stylesheet and four Blade templates, namely the hero, catalog, operations, and homepage views. No other changes were made, such as migrations, seeding, dependency alterations, or database edits.
The intriguing aspect of this release was not the design itself, but rather the discrepancy between the production worktree and the branch's state. The production checkout was at a different commit than the working copy, with its stylesheet featuring a hash that had been manually pinned from an inspected snapshot, rather than being derived from a commit. To ensure a scoped release over an existing production worktree, the production branch remained unaltered.
The release was structured as a list of five paths, each accompanied by a before_sha256 and an after_sha256. This information was documented in a manifest. The local release script would not proceed with the build unless the production templates matched the committed versions in the source checkout and the stylesheet matched the inspected hash. If either check failed, the payload wouldn't be uploaded.
The payload consisted of a tar of those five files, and the manifest recorded the production commit hash, the source commit hash, and the two digests per file. All operations were carried out inside an exclusive, non-blocking file lock to prevent simultaneous releases. Each step was checked before proceeding, with the application of the changes recorded in state.txt.
If an exception occurred during the apply block, a rollback was triggered. Rollback would refuse to overwrite a file whose current hash did not match either the before or after hash, thus preventing potential loss of changes made outside the release. Each backup was hashed against the before_sha256 before restoration, and the caches were rebuilt after restoring the backup. Finally, PHP-FPM was reloaded, and a Playwright script ensured no changes were submitted, confirming the success of the release.
Written by urgent.news from Dev.to's reporting — not their text. Machine-written — may contain errors; check the original before relying on it.