KeepAChangelog icon indicating copy to clipboard operation
KeepAChangelog copied to clipboard

Simple unreleased version and BuildDate config

Open tboby opened this issue 1 year ago • 5 comments

WHAT

This partially implements the automatic pre-release version bumping from #5. It's currently a very simply increment patch + "-alpha".

It also

  • Updates the changelog
  • Partially updates the readme
  • Continues to improve edge-cases and testing, such as only unreleased, no release at all
  • Adds a configuration property to disable writing the BuildDate to assembly metadata

WHY

It makes sense to try to prevent accidental publishing under old version numbers.

WHAT NOT

This doesn't do the clever major/minor/patch derivation, nor height.

tboby avatar Oct 26 '24 15:10 tboby

@baronfel I haven't added the configuration property for the AssemblyBuildDate because I'm not sure I understand why you would use it. Any chance you remember?

tboby avatar Oct 26 '24 15:10 tboby

The configuration would mostly come in because some people may not want dates of any kind 'stamped' into the assembly - Dates are a common source of non-determinism in builds and so it's common practice to either pin the date to UNIX epoch, omit the date entirely, or via some other means use a consistent date. I think it's safe-ish for this library because we would emit the date that's in the Changelog (and so would be stable), I'm just a bit cautious about dates in binaries in general.

baronfel avatar Oct 26 '24 18:10 baronfel

@baronfel Could you check that I've set appropriate BeforeTargets? I had to add something to ensure it all happened before Assembly Attributes were written, but it was a bit of a guess!

To be honest, I'm not entirely sure why it wasn't necessary before, unless the assembly wasn't having the version written to it? Or unspecified ordering getting lucky?

tboby avatar Oct 27 '24 16:10 tboby

Good point on the timing. There are 4 scenarios we need to care about to make sure all the versions are set at the right times and places:

  • dotnet pack of single-TFM project
  • dotnet pack of multi-TFM project
  • dotnet build of project (single or multi-TFM, doesn't matter since the artifacts from build are inherently single-TFM)
  • dotnet build of a project that references a project using this library (to ensure that building the referenced project computes versions correctly before that referenced project is used by the main project)

baronfel avatar Oct 27 '24 17:10 baronfel

@baronfel I've added testing for BuildDate + config, so I think this PR is ready. I'll look into the more sophisticated version bumping, and maybe creating a test solution with the different combinations. I'm going on holiday at the end of this week though, so that might not be imminent :)

tboby avatar Oct 29 '24 08:10 tboby