-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal: add zig pack
for creating release tarball of packages
#20882
Comments
Immediately after submitting I realized that |
As an additional idea, |
Possible duplicate of #14312. Also related is #19603 which is motivated by tooling for creating package tarballs. I don't have any especially strong opinions on the specific features of a potential |
zig release
for creating release zips of packageszig release
for creating release tarball of packages
zig release
for creating release tarball of packageszig pack
for creating release tarball of packages
Note that, eg, pre-release semver is before the associated semver with the same major.minor.patch but with no semver. So: 0.0.0 < 0.1.0-dev < 0.1.0 Also, I'm leaning more towards thinking that version just shouldn't be submitted to the repo. However there's more interactions with other tools I'm less familiar with to put forward a strong proposal for that. If anything, what is version right now should be renamed
Ah, yeah. It's pretty close but there's enough unique specifics about this proposal that I'll leave it up to a core team member to dedup or not.
Way better name, changed the proposal to match. |
Dupe of #14312. Your ideas are noted |
tl;dr:
With a build.zig.zon of:
and these files in the directory:
Running this command:
zig pack 0.1.0
Creates the file
zig-out/ziginit-0.1.0-BWdcABvF_jM1.tar.gz
Containing these files:
Except the contents of
build.zig.zon
have been modified to:Detailed reasoning
Semantic Versioning
As noted in #19765, committing a semantic version into a repository is problematic. Semantic versions are supposed to reference points in time, not ranges of possible contents. Additionally, pre-release tags are the mechanism for possible unstable or for temporarily breaking the API contract. https://semver.org/ is reasonably
grumpyprecise about these points.With the user experience as is, I don't expect this to be done correctly most of the time. Indeed looking at a few notable projects, I don't see any pre-release tags. When tools start referencing this version field, some dependencies referencing a non-release commit having the same version as another dep referencing a release commit, things are going to break.
Semi-related: In addition for proposal #8284 (comment), pre-release tags should be considered unstable for post 1.0 releases. This was proposed in the thread: #8284 (comment) The other version checks approved in this thread should also performed by
zig pack
, so that people don't make broken releases where the commit seems fine before marking the version, but marking the version as not a pre-release version suddenly breaks things.Also in response Loris mentioned something about "zig make-release", which sounds like this proposal, but I can't find any more references to that anywhere. So um... sorry if this is a duplicate of something I can't find.
Admittedly, I think a careful reading of semver says that even pre-release tags should be unique, but I think the above proposal is a pragmatic middle ground. An alternative would be to make the version field entirely optional, never included in commits, and only ever set by
zig pack
.Archive Contents
Already the cache will only keep files referenced by
.paths
. So there is little point in ever including such files in a release tar.gz in the first place. Asking someone to manually do it is silly. An automatic process is additionally a boon for reproducible releases, eg for verification purposes in security consensus contexts.Archive Naming
I yoinked the format from #20178. It'd be convenient for package archive names to fit a standard format, and while this wouldn't force it, it'd make it the happy path. Potentially makes the hash proposal irrelevant, as the hash being in the filename makes locating the hash by itself much easier.
Subjective Experience
The first time I did a package release, the process wasn't clear; So I just tagged a commit as
0.1.0
, and let the automatic Github archive link be the release url. This has all of the problems listed above, so not great. I think that having a top level command which just does things correctly would be a boon to the usability of Zig, reducing variability and guiding users towards good behavior. After this proposal, the only addition to the naive approach would be running the command and dropping the tar.gz file into the Github release.Other notes
The version field in the
zig init
zon file should be changed to be0.0.0-dev
, or similar. I also think add comment such asEdit log
zip
totar.gz
zig release
tozig pack
The text was updated successfully, but these errors were encountered: