Skip to content
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

feat(chocolatey): allow template in copyright, provide ctx.ReleaseNotes #4858

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
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.

None yet

2 participants