Publish pre-built binaries and packages with each release - #55
Open
bkeepers wants to merge 1 commit into
Open
Conversation
Pushing a vX.Y.Z tag builds macOS, Linux and Windows on x86-64 and arm64, attaches the archives, .debs and SHA256SUMS to the release, and regenerates the Homebrew tap formula. macOS builds run natively per arch because macho-align.sh repacks libtile57.a for the host only. Linux uses -gnu targets so libtile57.a stays glibc-linkable while build.zig retargets the CLI to static musl.
Owner
|
Is there a good way to test this without merging and tagging? I've found I always need to iterate a little on GHA and it creates a lot of clutter in the build pipeline/tags/commits. Maybe cloning the repo, merging there and testing, then pull any changes back into this PR? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a release workflow so that pushing a
vX.Y.Ztag produces downloadable binaries for macOS, Linux and Windows on both architectures, plus a Homebrew formula and a.deb.Adding a tag via
git tag v0.4.0 && git push origin v0.4.0or the GitHub Releases UI runs .github/workflows/release.yml, which:ReleaseFastfor six targets and packages each one astile57-<version>-<arch>-<os>.tar.gz, or.zipon Windows, carryingbin/tile57,lib/libtile57.a,include/tile57.h, and the licenses.tile57_<version>_{amd64,arm64}.debfrom the same payload.--generate-notes, all the archives, and aSHA256SUMSfile.Formula/tile57.rbin the Homebrew tap and pushes it.A tag carrying a suffix,
v0.4.0-rc1, publishes as a prerelease and skips the tap, so the whole matrix can be exercised without shipping anything.Before any of that, each build leg checks the tag against the version in
build.zig.zon,src/tile57.zigandtools/common.zig. A mismatch fails the build rather than shipping a binary whosetile57 versioncontradicts the file it arrived in.Two target choices
macOS builds run natively per arch instead of cross-compiling from one runner.
scripts/macho-align.shcallsld -randlibtoolwithout-arch, so it can only repacklibtile57.afor the host. Threading the target arch through that script would allow a single-runner build, but native runners cost no code. That threading is the fix if themacos-15-intelrunner is ever retired.Linux uses the
-gnutargets rather than-musl.build.zigalready retargets the CLI to static musl on a glibc host, so the-gnuarchives carry a portabletile57and alibtile57.athat a glibc C host can still link. Building-muslwould give up the second half of that.Packages
Homebrew covers macOS and Linux from one formula, generated by
scripts/brew-formula.shout of the checksums of the archives that were just built. The formula installs the binary, the static library and the header, and itstest doblock runstile57 version. Generating it beats hand-editing because all four checksums change every release. It does need a tap repo and a token, which is the checklist below.The
.debis a release asset, not an apt repository.sudo apt install ./tile57_0.4.0_amd64.debworks,apt install tile57does not. A real repository needs a signing key in secrets and somewhere to host the index, which seemed worth deferring until someone asks for it. Scoop, winget and AUR are out for the same reason.Docs
Installation leads with binaries and keeps building from source below them. Its note about
zig fetchbeing broken is gone:.pathsinbuild.zig.zoncoversvendor/,include/andtools/, and I confirmed that a fetched package buildslibtile57.awith no submodules initialised, so the lazys101_portrayaldependency is doing its job. The same stale note in Zig API is replaced with thezig fetch --saveline. Contributing gains the release steps.Tested
The
.debwas built and inspected withdpkg-deb, so root ownership, the control fields, and the layout under/usrare all confirmed. Tarball layout checked. Formula generation checked, including its non-zero exit when an archive is missing.actionlintandshellcheckare clean, and azig fetched package built tolibtile57.awithout submodules.The macOS legs are the untested part. CI has never built Darwin, so an
-rc1tag should come before the real one.TODO
Before the first tag:
beetlebugorg/homebrew-tap. Public, and empty is fine, since the workflow createsFormula/.contents: writeon that repository, either a fine-grained PAT scoped to it or a GitHub App installation token.HOMEBREW_TAP_TOKEN.contents: write, but the repository's workflow-permissions setting has to allow it.homebrew-taporhomebrew-tile57. The URL is written into the workflow and intodocs/docs/installation.md.Without the secret the tap step logs a warning and exits, and the release still publishes.
First release:
v0.3.0-rc1and confirm all six build legs go green, especially the two macOS ones..deband check they run on a clean machine.brew install beetlebugorg/tap/tile57on macOS and on Linux.docs/docs/installation.md.Not in this PR, worth considering later:
xattr -d com.apple.quarantine. Needs an Apple Developer account and certificates in secrets.apt install tile57is wanted.macos-latesttoci.ymlso Darwin breakage surfaces on PRs instead of at tag time.