Skip to content

Build the phar in the release workflow - #67

Merged
mattiasgeniar merged 8 commits into
mainfrom
ci/build-phar-on-release
Oct 23, 2026
Merged

mattiasgeniar merged 8 commits into
mainfrom
ci/build-phar-on-release

Conversation

@Nelwhix

@Nelwhix Nelwhix commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Summary

The Release workflow uploads the committed builds/ohdear as-is, and the Docker image copies the same file. A release only gets new code if someone rebuilds and commits the phar before tagging. This has gone wrong twice:

This PR adds a build job that runs on the tagged commit:

  1. Fails the release if the committed builds/ohdear doesn't report the tag's version. Composer installs run that file, so it still has to be rebuilt and committed before tagging.
  2. Installs dependencies from composer.lock on PHP 8.4
  3. Runs php ohdear app:build ohdear --build-version=<tag without v>
  4. Fails the release if ohdear --version doesn't report the tag's version
  5. Uploads the phar as an artifact

phar-release and docker-release now depend on build and use that artifact instead of the committed file. The Docker job restores the executable bit, because artifacts don't keep file modes and the image runs /ohdear directly.

The workflow now defaults to read-only permissions, with contents: write only on phar-release. Tags with a - (like v5.5.0-rc.1) publish as prereleases, and the release and artifact actions are on their current major versions.

Testing

  • Ran the build and version-check steps locally with GITHUB_REF_NAME=v9.9.9. The phar reported Oh Dear 9.9.9 and the check passed. A mismatched tag makes the check fail as intended.
  • Parsed the workflow and checked the job dependencies and step order.
  • I haven't run the workflow on GitHub, since it only triggers on a tag push. The next tag will be its first real run.

Notes

  • builds/ohdear is still committed. Once this has shipped a release, we could remove it and stop rebuilding it by hand, but I've left that for a separate change.
  • If Rebuild phar for 5.4.1 #66 merges first, tagging v5.4.1 works with or without this PR. With this PR, the phar is rebuilt from the tag either way.

The release workflow uploaded the committed builds/ohdear as-is, so a
release only contained new code if someone remembered to rebuild and
commit the phar first. v5.3.0 needed a follow-up rebuild, and v5.4.0
shipped the 5.3.0 binary.

Add a build job that compiles the phar from the tagged commit with the
tag as its version, checks that --version matches, and hands it to
both the GitHub release and Docker jobs.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@Nelwhix
Nelwhix requested a review from mattiasgeniar October 22, 2026 12:26
@mattiasgeniar

Copy link
Copy Markdown
Contributor

Nice, thanks!

@mattiasgeniar
mattiasgeniar merged commit bd40a26 into main Oct 23, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants