Skip to content

Conversation

bradenhilton
Copy link
Contributor

@bradenhilton bradenhilton commented May 13, 2024

This PR allows chocolateys.copyright to be templated, and provides ctx.ReleaseNotes as .Changelog.

Allowing templates for the copyright will enable, for example:

chocolateys:
- ...
  copyright: Copyright (c) 1970-{{ .Now.Format "2006" }} Foo Bar
  ...

Without this change:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
  <metadata>
    ...
    <copyright>Copyright (c) 1970-{{ .Now.Format &#34;2006&#34; }} Foo Bar</copyright>
    ...
  </metadata>
  ...
</package>

With this change:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
  <metadata>
    ...
    <copyright>Copyright (c) 1970-2024 Foo Bar</copyright>
    ...
  </metadata>
  ...
</package>

Providing the release notes means they can be placed directly in the package page instead of linking to them, for example:

chocolateys:
- ...
  release_notes: '{{ .Changelog }}'
  ...

Without this change:

goreleaser release --skip=sign,announce,publish --clean
  • starting release...
  ...
  • chocolatey packages
    ⨯ release failed after 4s                  error=template: failed to apply "{{ .Changelog }}": template: failed to apply "{{ .Changelog }}": map has no entry for key "Changelog"

With this change:

<?xml version="1.0" encoding="utf-8"?>
<package xmlns="http://schemas.microsoft.com/packaging/2015/06/nuspec.xsd">
  <metadata>
    ...
    <releaseNotes>## Changelog&#xA;### Other&#xA;* cfa5cbfa5 test&#xA;</releaseNotes>
    ...
  </metadata>
  ...
</package>

These are already supported for WinGet.

There is probably a better way of doing this, and I've probably also missed something, so feedback is welcome!

@pull-request-size pull-request-size bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 13, 2024
caarlos0 pushed a commit that referenced this pull request May 13, 2024
I noticed this while working on
#4858.
@caarlos0
Copy link
Member

hey! thanks for the PR!

for full transparency: I plan to release v2 as 1.26 minus the deprecations, so this will probably land in v2.1 only.

I'm aiming to release v2 either this weekend or the next, depending if I get any bug reports during this time

@caarlos0 caarlos0 added the enhancement New feature or request label Jun 9, 2024
@caarlos0 caarlos0 added this to the v2.1.0 milestone Jun 9, 2024
Copy link

codecov bot commented Jun 9, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.91%. Comparing base (c68d830) to head (2101c57).
Report is 328 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #4858      +/-   ##
==========================================
+ Coverage   83.77%   83.91%   +0.14%     
==========================================
  Files         135      139       +4     
  Lines       13029    11113    -1916     
==========================================
- Hits        10915     9326    -1589     
+ Misses       1677     1334     -343     
- Partials      437      453      +16     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@caarlos0 caarlos0 merged commit ac40ce8 into goreleaser:main Jun 11, 2024
@bradenhilton bradenhilton deleted the choco-tmpl branch June 27, 2024 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants