tested this on a fake repo, and it seems to fix the problem...
seems like choco does not like when the path has `/` in it, so passing
it through `filepath.Clean` fixes it.
also improved tests a bit, and made a small docs fix.
closes https://github.com/goreleaser/goreleaser/issues/4292
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
The gomod pipe will skip if the Go version does not support modules.
<!-- Why is this change being made? -->
I tried to use goreleaser to build a project with Go v1.8.7 and it
failed on `loading go mod information` step. The Go version used doesn't
support `go list -m`.
The build failed with the following error:
```
• loading go mod information
⨯ release failed after 0s error=failed to get module path: exit status 2: flag provided but not defined: -m
usage: list [-e] [-f format] [-json] [build flags] [packages]
List lists the packages named by the import paths, one per line.
...
```
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
...
the publish pipe, which runs all publishers, already skips all
publishers if skip publish is set, so this check is not needed here.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
the publish pipe, which runs all publishers, already skips all
publishers if skip publish is set, so this check is not needed here.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
the publish pipe, which runs all publishers, already skips all
publishers if skip publish is set, so this check is not needed here.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Currently, GoReleaser will assume you're running against github, gitea
or gitlab.
You could set `release.disable: true`, but it would still set and try to
use some defaults that could break things up.
Now, if you disable the release, goreleaser will not set these defaults.
It'll also hard error in some cases in which it would happily produce
invalid resources before, namely, if `release.disable` is set, and, for
example, `brews.url_template` is empty (in which case it would try to
use the one from the release, usually github).
closes#4208
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
`docker` packaging does not honor the path structure defined in
builds/binary
it copies all binaries to temp docker build folder
this PR fixes the behavior and make it same as `archive`
for example
```
builds:
- id: xxx
binary: plugins/xxx
```
before:
```
/tmp/goreleaserdocker2210262014/xxx
```
after:
```
/tmp/goreleaserdocker2210262014/plugins/xxx
```
<!-- If applied, this commit will... -->
<!-- Why is this change being made? -->
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
- improves deprecation warning styles a bit so they caught the readers
eye faster and are easier to read
- warns if the user uses `builds.target` in conjunction with other
options which are ignored in that case
- improved env output
- improved no configuration found warning
some of the changes:
<img width="1263" alt="CleanShot 2023-07-24 at 21 38 41@2x"
src="https://github.com/goreleaser/goreleaser/assets/245435/40465853-7177-44d6-b07b-61b67590669a">
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
If an archive filename contains `/` characters, they can sneak into
Winget's `RelativeFilePath`.
In this PR, I make sure that `RelativeFilePath` only uses `\` directory
separators.
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
Delete the temporary directory used for building Docker images.
<!-- Why is this change being made? -->
Leaving the temporary directory leads to wasted disk space.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
This adds missing fields:
- LicenseURL
- CopyrightURL
- Tags
As well as make several more fields templateable.
cc/ @twpayne
Co-authored-by: Tom Payne <tom.payne@flarm.com>
- nix.description, nix.path, and nix.homepage should allow templates
- nix.path was defaulting to wrong value, fixed
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
The check to skip Scoop releases when SCM ones are disabled seems to be
the only place where this is happening and in conflict to Brew releases.
These two need not be linked as users can configure the `url_template`
to point elsewhere.
---
Consider the following use case:
```
* goreleaser/my-app.yml
- builds: spec for building a Go binary for my-app
- dockers: spec for packaging my-app in a container and pushing to Artifactory & GCP
- archives: spec for zipping up my-app binary
- artifactories: spec for pushing archives of my-app to a private jfrog artifactory
- brews: spec for publishing my-app through brew on macOS with URLs from artifactory
- scoop: spec for publishing my-app through scoop on Windows with URLs from artifactory
- release: disabled SCM (e.g. GitHub) release
```
Running `goreleaser release -f goreleaser/my-app.yml` with the above
setup results in the correct artifacts (archives & containers) being
published to Artifactory, GCP, Brew, but no Scoop.
Given that Scoop's `skip_upload` cannot be templated in 1.18 and I do
not wish to have SCM releases & tags on every release, one can be rather
stuck.
We have been using `t.Setenv` is most of our tests. This PR replaces the
remaining `os.Setenv` with `t.Setenv`.
Reference: https://pkg.go.dev/testing#T.Setenv
```go
func TestFoo(t *testing.T) {
// before
os.Setenv(key, "new value")
defer os.Unsetenv(key)
// after
t.Setenv(key, "new value")
}
```
---------
Signed-off-by: Eng Zer Jun <engzerjun@gmail.com>
It will otherwise create the empty fields in the yaml, and snapcraft
then complains they are empty and fail.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
mimic the structure to be created in the target repo, and put each of
them in its own folder.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
nfpm was updated, but we never allowed to configure the umask field in
goreleaser.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
closes#3989
Basically, when some of these pipes fail, the error will be memorized,
and all errors will be thrown in the end.
Meaning: the exit code will still be 1, but it'll not have stopped in
the first error.
Thinking of maybe adding a `--fail-fast` flag to disable this behavior
as well 🤔
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
using the new multiple files api to have a single commit/push for all
files of a package.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
this will add support to winget into goreleaser.
Basically, the plan is:
- we generate the 3 needed yaml files
- we commit them to a repo
and that's it.
Initially, will probably have limited options support, and will only
have the default locale.
###### TODO
- [x] docs
- [x] review by someone who knows how this works?
- [x] test install somewhere
- [x] more tests maybe?
- [x] PR templates via API?
https://github.com/goreleaser/goreleaser/pull/4105
- [x] real project test
- [x] setup goreleaser to pr to winget as well
- [x] document sync fork stuff
https://github.com/goreleaser/goreleaser/pull/4106
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
It should make goreleaser easier to use, as a `repository` is now always
called `repository`.
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
since this will be a late, big release, let's remove the deprecated
stuff that expired
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
this would allow to add the checksums to the body of the release
contents, for example.
refs https://github.com/orgs/goreleaser/discussions/4063
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This allows to open pull requests across repositories on nix, brew, krew
and scoop.
closes#4048
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
add ko-generated manifests to the artifact list, this way they can be
signed later.
closes#4027
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Empty tag names will then be filtered out. This allows to have optional
tags depending on templates, for example,
`{{if not .Prerelease}}latest{{end}}`, among other use cases.
This already happens in the `dockers` section, and is now implemented in
`kos` too.
refs https://github.com/orgs/goreleaser/discussions/4042
The lintian files were being written for every format, whether they were
a deb or not.
Since package name and arches are the same, and packaging runs in
parallel, it could happen that one goroutine is reading while the other
is writing, as we were guaranteeing uniquenes based on package name and
arch only.
This makes it only creates the lintian files when format is deb, so this
shouldn't happen anymore.
It also goes one step further by using the actual format in the filepath
instead of hard-coding "deb".
This also still supports tmux.
closes#4024
very, very, very WIP implementation of nixpkgs for GoReleaser.
**Decisions made for this first version:**
- only linux and darwin, arm64, 386 and amd64
- only support pkgs from goreleaser-generated archives
- no support to push into default nixpkgs repository
- no support to automatically add the _maybe_ new pkg to the root
`default.nix`
- the generated nixpkg will be rather verbose, which shouldn't be too
much of an issue as it is autogenerated anyway
**TODOs**:
- [x] macos universal binary support
- [x] custom pkg path (e.g. pkgs/misc/foo/bar/default.nix)
- [x] handle archives with a folder in them
- [x] add more options: postInstall, ??
**Will be handled in future versions**:
- [ ] archives.format=binary support
- [ ] compile from source
- [ ] PR-ing into nixpkgs
- [ ] armv6l-linux & armv7l-linux support
closes#3537
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Adjust the logging of warnings for unmatched globs to only show when the
glob is not a default. No warning will be output for the default globs
when there are no matching files.
These are defaults, by design, very generic.
We should not warn the user about them not finding anything, as that is
their expected behavior most of the time.
- log keys will be ordered as intended instead of sorted
- paths always relative to cwd
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
this adds a new root-level `upx` config, so users can pack their
binaries with upx :)
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This brings the scoops feature a bit more closer to similar pipes, like
brew and krew.
- It now supports multiple scoops
- It improves some validations to prevent wrong manifests
- It uses extra.binaries instead of extra.builds, as brew does too
- extra.builds is now unused, will be removed in a subsequent PR
- More tests were added as well
closes#3941
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
basically redoing #3559 as it got impossible to merge with the many
changes since it was open (which is totally my fault for not merging it
earlier).
Anyhow, still a WIP, going also doing some other related improvements in
the way.
cc/ @graytonio
closes#3559closes#3525
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Grayton Ward <graytonio.ward@gmail.com>
This adds a log with the size of the generated binaries/packages/etc in
the end of the build process, and also adds it to the artifacts.json
closes#3949
TODO:
- [x] tests
- [x] docs
- [ ] ??
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Bumps
[github.com/charmbracelet/keygen](https://github.com/charmbracelet/keygen)
from 0.3.0 to 0.4.1.
<details>
<summary>Release notes</summary>
<p><em>Sourced from <a
href="https://github.com/charmbracelet/keygen/releases">github.com/charmbracelet/keygen's
releases</a>.</em></p>
<blockquote>
<h2>v0.4.1</h2>
<h2>Changelog</h2>
<h3>Bug fixes</h3>
<ul>
<li>ba5b3746062cbc051702c188911f44c1e2b5c986: fix: don't trim key path
(<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
</ul>
<hr />
<p><!-- raw HTML omitted --><!-- raw HTML omitted --><!-- raw HTML
omitted --></p>
<p>Thoughts? Questions? We love hearing from you. Feel free to reach out
on <a href="https://twitter.com/charmcli">Twitter</a>, <a
href="https://mastodon.technology/@charm">The Fediverse</a>, or on <a
href="https://charm.sh/chat">Discord</a>.</p>
<h2>v0.4.0</h2>
<h1>Breaking Change</h1>
<ul>
<li>Keygen no longer appends the key type to the file path.</li>
<li>Use functional options to specify key type, passphrase, and other
options.</li>
<li><code>PrivateKeyPEM</code> is now <code>RawPrivateKey</code></li>
<li><code>RawProtectedPrivateKey</code> returns the password protected
PEM encoded private key.</li>
<li><code>PublicKey</code> is now <code>RawAuthorizedKey</code>.</li>
<li><code>AuthorizedKey</code> returns the authorized key stripped out
of comments and options (the ssh pubic key only).</li>
<li><code>PrivateKey</code> now returns the underlying
<code>crypto.PrivateKey</code></li>
<li>Use <code>Signer</code> to get an <code>ssh.Signer</code> from your
key pair.</li>
</ul>
<h2>Changelog</h2>
<h3>New Features</h3>
<ul>
<li>ab32d1ae447e5d74a47dd64ec2e75d0a827ccc9b: feat(ci): add workflows
and goreleaser (<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
<li>6ed037835403e5da4a2aa10e5c8568ff4a3bad41: feat: add more tests (<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
<li>37c7434ac69d79048521a7e4bfa0f9dfbb0c1f23: feat: bump dependencies
(<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
<li>8d80e760657463eda55e2f0c773ed3fe3b3e3b08: feat: return ssh.Signer
(<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
<li>6c0cbbb70022377d611d25d98836e016b2c145a5: feat: specify ECDSA
elliptic curve (<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
</ul>
<h3>Bug fixes</h3>
<ul>
<li>30d86a9582001686d63de3f79e4e90a7b6a62a9e: fix: update x/crypto (<a
href="https://redirect.github.com/charmbracelet/keygen/issues/8">#8</a>)
(<a href="https://github.com/caarlos0"><code>@caarlos0</code></a>)</li>
</ul>
<h3>Documentation updates</h3>
<ul>
<li>eef068dedc6af24e8eda0c99db3a03c988b46cff: docs: new readme footer
(<a href="https://github.com/muesli"><code>@muesli</code></a>)</li>
<li>f7556041d69b45aef018df2269d29e6d018ae6cc: docs: update example in
readme (<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
</ul>
<h3>Other work</h3>
<ul>
<li>472a463d0e8df9e768b350d75ee57a8c9baf69d6: ref: change api to expose
ssh.PublicKey and authorizd_key (<a
href="https://github.com/aymanbagabas"><code>@aymanbagabas</code></a>)</li>
</ul>
<hr />
<p><!-- raw HTML omitted --><!-- raw HTML omitted --><!-- raw HTML
omitted --></p>
<p>Thoughts? Questions? We love hearing from you. Feel free to reach out
on <a href="https://twitter.com/charmcli">Twitter</a>, <a
href="https://mastodon.technology/@charm">The Fediverse</a>, or on <a
href="https://charm.sh/chat">Discord</a>.</p>
</blockquote>
</details>
<details>
<summary>Commits</summary>
<ul>
<li><a
href="ba5b374606"><code>ba5b374</code></a>
fix: don't trim key path</li>
<li><a
href="6ed0378354"><code>6ed0378</code></a>
feat: add more tests</li>
<li><a
href="6c0cbbb700"><code>6c0cbbb</code></a>
feat: specify ECDSA elliptic curve</li>
<li><a
href="8d80e76065"><code>8d80e76</code></a>
feat: return ssh.Signer</li>
<li><a
href="3dbbf0ca45"><code>3dbbf0c</code></a>
chore: go mod tidy</li>
<li><a
href="37c7434ac6"><code>37c7434</code></a>
feat: bump dependencies</li>
<li><a
href="472a463d0e"><code>472a463</code></a>
ref: change api to expose ssh.PublicKey and authorizd_key</li>
<li><a
href="30d86a9582"><code>30d86a9</code></a>
fix: update x/crypto (<a
href="https://redirect.github.com/charmbracelet/keygen/issues/8">#8</a>)</li>
<li><a
href="eef068dedc"><code>eef068d</code></a>
docs: new readme footer</li>
<li><a
href="f7556041d6"><code>f755604</code></a>
docs: update example in readme</li>
<li>Additional commits viewable in <a
href="https://github.com/charmbracelet/keygen/compare/v0.3.0...v0.4.1">compare
view</a></li>
</ul>
</details>
<br />
[![Dependabot compatibility
score](https://dependabot-badges.githubapp.com/badges/compatibility_score?dependency-name=github.com/charmbracelet/keygen&package-manager=go_modules&previous-version=0.3.0&new-version=0.4.1)](https://docs.github.com/en/github/managing-security-vulnerabilities/about-dependabot-security-updates#about-compatibility-scores)
Dependabot will resolve any conflicts with this PR as long as you don't
alter it yourself. You can also trigger a rebase manually by commenting
`@dependabot rebase`.
[//]: # (dependabot-automerge-start)
[//]: # (dependabot-automerge-end)
---
<details>
<summary>Dependabot commands and options</summary>
<br />
You can trigger Dependabot actions by commenting on this PR:
- `@dependabot rebase` will rebase this PR
- `@dependabot recreate` will recreate this PR, overwriting any edits
that have been made to it
- `@dependabot merge` will merge this PR after your CI passes on it
- `@dependabot squash and merge` will squash and merge this PR after
your CI passes on it
- `@dependabot cancel merge` will cancel a previously requested merge
and block automerging
- `@dependabot reopen` will reopen this PR if it is closed
- `@dependabot close` will close this PR and stop Dependabot recreating
it. You can achieve the same result by closing it manually
- `@dependabot ignore this major version` will close this PR and stop
Dependabot creating any more for this major version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this minor version` will close this PR and stop
Dependabot creating any more for this minor version (unless you reopen
the PR or upgrade to it yourself)
- `@dependabot ignore this dependency` will close this PR and stop
Dependabot creating any more for this dependency (unless you reopen the
PR or upgrade to it yourself)
</details>
---------
Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This now works for files added to the source archive **after** the `git
archive` command is run. During the `git archive`, it seems that the
`tar` is still using some format that doesn't support utf-8 by default.
Tomorrow I'll look more into it.
see https://pkg.go.dev/archive/tar#Formatcloses#3812
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-Authored-By: Mohammed Al Sahaf <msaa1990@gmail.com>
Add extension to produced artifacts so that they can be filtered in
later steps
Fixes#3933
Co-authored-by: Carlos A Becker <caarlos0@users.noreply.github.com>
its too hard to debug docker build issues... sometimes is just a typo in
the binary name, and you might end debugging it for way too long...
this prints the full path to the build context (so, locally at least,
you can cd into it) and also all the files available there when the
error seems to be one of the "file not found" kind.
Hopefully this helps fixing things easier :)
closes#3912
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This reverts back to using `git archive` for the source archives... but
will keep supporting extra files.
##### How it works:
Basically, we run `git archive` as before.
Then, we make a backup of the generated archive, and create a new one
copying by reading from the backup and writing into the new one.
Finally, we write the extra files to the new one as well.
This only happens if the configuration does have extra files, otherwise,
just the simple `git archive` will be run.
PS: we can't just append to the archive because weird tar format
paddings et al.
---------
Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
closes#3485
also fixed a bug in file creation for github: it was always searching
for the file in the default branch
also, we don't need to create the file first, update does both create
and update.
TODO: implement the for krew, scoop, etc...
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This would allow to, when multiple tokens are set in the environment,
force which one you want to use.
The need for this comes from the fact gitea sets both `GITHUB_TOKEN` and
`GITEA_TOKEN`, and doesn't allow to easily disable either.
With this, users can add a `GORELEASER_FORCE_TOKEN=gitea` to force the
gitea client to be used.
I'm not sure what's the best name for this env yet, happy to hear
suggestions.
Also improved the `env_test.go` file a bit, as it was kinda messy with
env vars...
refs https://github.com/orgs/goreleaser/discussions/3900
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Fixes issue #3890 by checking the user's git `gpg.program`
configuration. If the user didn't set this value it will use the default
"gpg", just like before this PR.
No need to add a additional unit test as your existing tests cover it
(mostly); however, a comment has been added to that check, informing the
reader that the test environment assumes `git config gpg.program` is not
be set.
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
This commit will fix bad version tag sort if there is a prerelease on
the same commit as a release tag. Current output is shown below
```
❯ git tag --points-at HEAD --sort=-version:refname --format='%(creatordate)%09%(refname)'
Thu Mar 2 21:38:51 2023 +0300 refs/tags/v1.13.0-rc3
Thu Mar 2 21:38:51 2023 +0300 refs/tags/v1.13.0
```
Test is changed to match current default value so it will fail without
this fix.
Default value `-` is set to the one that is described inside
[docs](https://goreleaser.com/how-it-works/?h=prerelease#how-it-works),
but people are still allowed to change it.
Output with fix applied
```
❯ git -c versionsort.suffix=- tag --points-at HEAD --sort -version:refname --format='%(creatordate)%09%(refname)'
Thu Mar 2 21:38:51 2023 +0300 refs/tags/v1.13.0
Thu Mar 2 21:38:51 2023 +0300 refs/tags/v1.13.0-rc3
```
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
More info about `versionsort.suffix` can be found
[here](https://github.com/git/git/blob/master/Documentation/config/versionsort.txt#L5)
Docs as well both schemas are updated as well.
I am not sure if users should be allowed to change this option at all.
here's an idea: `goreleaser healthcheck`
It'll check if the needed dependencies (docker, git, etc) are available
in the path... this way users can preemptively run it before releasing
or to debug issues.
What do you think?
Here's how it looks like:
<img width="1007" alt="CleanShot 2023-03-02 at 23 24 26@2x"
src="https://user-images.githubusercontent.com/245435/222615682-d9cd0733-d900-43d1-9166-23b2be589b3a.png">
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
If all other strategies fail, try to infer the `package_name` property
from the `go.mod` file, using its last segment as the actual package
name.
This is not perfect, but usually this will only be used when running
against a new project, with no git url, empty/default config, etc... so,
in reality, it'll rarely be used.
closes#3825
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Creating the temp dir for docker builds was required back in the day
because we symlinked the files, so to avoid different filesystems et al,
this was the easier solution.
Since many versions ago, we switched to copying the files instead, which
works a lot better.
This also means we don't need the dist check for extra files anymore, as
long as we create the temp outside dist.
All that said, this PR does 2 things:
- changes the docker pipe to create the dist in the user's tempdir
instead of dist
- removes the dist path check for docker's extra files
closes#3790closes#3791
cosign v2 update!
- need to use `--yes` to auto-approve prompts
cc/ @cpanato anything else I'm missing?
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
alternative to #3806
the idea is that both `context.New` and `context.Context{}` are never
used in tests.
not sure yet how much I like it, so far code does look a bit more
readable though.
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
it was forcing to provide the same information as env and yaml.
this should fix it.
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This option was still being supported, even though undocumented, for
many years now.
I think it's finally time to sunset it for good, in 6 months :)
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
update everything to go 1.20
---------
Signed-off-by: dependabot[bot] <support@github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
do not write fields et al, let it just roll, otherwise its too noisy,
and we might expose things we are not supposed to.
closes#3741
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
The commit will add the `bare` option to ko publisher options when
set/passed via config `.goreleaser.yaml`.
Currently, even the `bare: true` is set via config, the option was never
passed to `ko` PublisherOptions.
#3742
---------
Co-authored-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
- improved how we handle `--rm-dist` deprecation so it looks more like
other deprecations
- improved deprecation error message a bit as well
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
- added a tmpl.Bool that checks if the result of a template is "true"
- added an ErrSkipper interface so Skip() methods can return errors as well
---------
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
After talking with @perylemke, we realized that probably most people
will likely expect it to be called --clean instead of --rm-dist, as its
more similar to the popular `make clean` task.
This adds the --clean flag, and make the --rm-dist one deprecated.
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
continuing the PR by @developer-guy
- [x] should be a publisher, as it does publish the images it builds
every time
- [x] `Default` method does not work
- [x] the `fromConfig` thing should probably be on the defaults, too
- [x] wire `--skip-ko`
- [x] documentation
- [x] more tests
- [x] use same registry as docker tests does
- [ ] see if we can make the log output match goreleaser's
- [ ] ??
closes#2556closes#3490
Signed-off-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: actions-user <actions@github.com>
Co-authored-by: Jason Hall <jason@chainguard.dev>
Co-authored-by: Batuhan Apaydın <batuhan.apaydin@trendyol.com>
To help solve this issue
```
apk:
signature:
key_file: "{{ .Env.ABUILD_KEY_NAME }}.rsa"
key_name: "{{ .Env.ABUILD_KEY_NAME }}"
```
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
Allow that the key_name in apk signature to be templated
<!-- Why is this change being made? -->
The name of the key might not be hardcoded, in a github workflow
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
...
This prevents one announce failure to skip all other announcers.
The release will still report a failure in the end, but will not fail in
the first failure.
Also improved errors messages a little bit.
closes#3663
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
with this patch, a config like:
```yaml
archives:
- format: tar.gz
# this name template makes the OS and Arch compatible with the results of uname.
name_template: >-
{{ .ProjectName }}_
{{- title .Os }}_
{{- if eq .Arch "amd64" }}x86_64
{{- else if eq .Arch "386" }}i386
{{- else }}{{ .Arch }}{{ end }}
{{- if .Arm }}v{{ .Arm }}{{ end }}
rlcp: true
files:
- src: "build/**/*"
dst: .
nfpms:
- package_name: foo
contents:
- src: "build/**/*"
dst: usr/share/foo
formats:
- apk
```
will eval this:
<img width="1384" alt="CleanShot 2022-12-21 at 22 21 00@2x"
src="https://user-images.githubusercontent.com/245435/209034244-7c31b5f7-cfcd-4825-bb2f-7dd463c5286a.png">
as much as I would like to make this the default, it would be a breaking
change, so we really can't do it.
If `dst` is empty, it'll have the same behavior as before (no rlcp), and
if `strip_parent` is set, it will also still have the same behavior.
Finally, if the format is binary, `rlcp` is ignored too (as it doesn't
make sense).
So, this only changes if:
- your format is not binary; and
- you have files with `src` and `dst` set
Then, goreleaser will warn you to set `rlcp: true`.
## todo
- [x] docs
- [x] more tests probably
- [x] any ideas for a better name for the new config option?
fixes#3655
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
GoReleaser evolved a lot since the last time I tried to implement this
>1 year ago.
Now its 100% possible, and way simpler to do it!
closes#3580
refs #2583
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
The replacements thing was always a bit weird, especially on archives.
We can solve that with templates, so, removing I'm deprecating it.
Also did the same on other places that had it the same feature.
Closes#3588
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
this use the digests on the manifest creation.
Another PR will add it to signing too.
refs #3496
refs #3540
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
this drives it home by using the actual images/manifest digests to sign
with cosign by default.
the default signing command is changing in this PR, but since `digest`
should be always there (if not, the pipeline will fail way earlier), it
should be fine.
refs https://github.com/goreleaser/goreleaser/issues/3496
refs https://github.com/goreleaser/goreleaser/pull/3540
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Following #3540, output artifacts' checksums to the artifact info.
This addition makes it easier to consume the checksums, especially when
running from e.g. GitHub Actions.
New tests:
1. Add a check for the checksum in the extra field.
2. Add a test for every checksum algorithm (to see that it doesn't break
for any algo's output).
3. Add a case of a binary and an extra file (to see that the logic
doesn't break when there's a mix).
p.s.
While working on that, I noticed that the convention for extra fields is
actually to use UpperCamelCase rather than lower.
I was mistaken because I looked at the subfields of the "DockerConfig"
extra field.
I think it's a good idea to fix it quickly, before the next release
rolls and it becomes a compatibility issue.
I took the liberty to fix it here as an extra commit. Please let me know
if you want it to be in a separate PR.
---
Tests:
```
go test
• refreshing checksums file=binary_bar_checksums.txt
• refreshing checksums file=binary_bar_checksums.txt
• refreshing checksums file=binary_bar_checksums.txt
PASS
ok github.com/goreleaser/goreleaser/internal/pipe/checksums 0.184s
```
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
Extract the digest (sha256) of docker images from the `docker push`
command for dockers published to the docker registry.
Outputting the digest is required to avoid a race condition when
referencing the image, where the image tag is being modified before the
reference is done.
See this [blog
post](https://github.com/goreleaser/goreleaser/issues/3496) for more
info.
This PR fixes https://github.com/goreleaser/goreleaser/issues/3496.
Note that the 'publish' pipe now must run before the 'metadata' pipe, so
that the information extracted during the 'publish' pipe would appear in
the metadata.
Previously, the published docker images metadata wasn't printed (because
of the order). It made sense because the content of the published image
was just a subset of the local one.
Now that it is printed to the metadata, it should have a different name
to avoid confusion.
As I mentioned, it wasn't printed before - so there shouldn't be any
backward-compatibility issues.
---
Local tests:
```
go test -v .
=== RUN TestVersion
=== RUN TestVersion/only_version
=== RUN TestVersion/version_and_date
=== RUN TestVersion/version,_date,_built_by
=== RUN TestVersion/all_empty
=== RUN TestVersion/complete
--- PASS: TestVersion (0.00s)
--- PASS: TestVersion/only_version (0.00s)
--- PASS: TestVersion/version_and_date (0.00s)
--- PASS: TestVersion/version,_date,_built_by (0.00s)
--- PASS: TestVersion/all_empty (0.00s)
--- PASS: TestVersion/complete (0.00s)
PASS
ok github.com/goreleaser/goreleaser 0.764s
```
Output example:
```
{
"name": "gallegit/hello-world:latest",
"path": "gallegit/hello-world:latest",
"goos": "linux",
"goarch": "amd64",
"internal_type": 10,
"type": "Published Docker Image",
"extra": {
"digest": "sha256:c3f7dd196a046dc061236d3c6ae1e2946269e90da30b0a959240ca799750e632"
}
}
```
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This PR adds support for generating the structure used to pack and push
Chocolatey Packages. And will solve the #3154
Is not ready for merge yet, but has the main structure, and ready for
comments.
Accordingly to Chocolatey, in order to build a package, it's necessary a
`.nuspec` and `chocolateyinstall.ps1` files at least, having these ones,
we could pack and distribute without adding the binary inside the final
package and that was implemented here.
To complete, will be necessary to define the package build and
distribute, however will be required to have Chocolatey installed
(Windows Only). One of alternatives that I thought was, publish the
files like Scoop and Brew in a separate repository, and there we could
use `chocolatey` through
[crazy-max/ghaction-chocolatey](https://github.com/crazy-max/ghaction-chocolatey).
Chocolatey has a lot of good examples of repositories:
https://github.com/chocolatey-community/chocolatey-packages/tree/master/automatic/curl
A final compilation of the missing parts:
- [x] How to pack and push (chocolatey)
- [x] Documentation
Sorry for the long description😄
All feedback very welcome!
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
This PR improves the handling of shared or static libraries by
GoReleaser. It uses the default behaviour of the Go compiler by
appending the right extension to libraries.
* `.so` and `.a` for Linux shared libraries and static libraries
respectively
* `.dylib` and `.a.` on Darwin
* `.dll` and `.lib` on Windows (pre-existent)
It does not add any configuration option to `.goreleaser.yml`, since it
leverages the existing `buildmode` flag.
Additionally, this PR takes care of adding the generated header file
into the archive.
<!-- Why is this change being made? -->
Personally I would leverage this change to release some software both as
a CLI and as a shared library. I believe others who use CGo or need
interoperability with Go from other languages could benefit from this.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
This was previously discussed in #3497.
I couldn't quite think of a proper way to add some tests to the header
archiving feature. Any recommendation?
Fix the regular expressions used in changelog group processing to valid
golang (RE2) regexps. These previously used PCRE character class `\w`
which is not supported in RE2 which is what golang regexp uses.
Also document that format matches not just title as some may thing but
the format `<abbrev-commit> <title-commit>`.
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
This PR implements the Archlinux packages that were added in nfpm
v2.20.0, as well as tests and documentation for them.
<!-- Why is this change being made? -->
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
goreleaser/nfpm#133
goreleaser/nfpm#543
Fixes#3469
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
closes#3508
- adds template support for krew and scoop repo refs
- template branch on reporef on brew as well
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
This PR will truncate any trailing slash left by specifying only a Gitea
API URL.
Fixes#3487
I have not added any tests for this.
Signed-off-by: Sam Therapy <sam@samtherapy.net>
Co-authored-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
<!--
Hi, thanks for contributing!
Please make sure you read our CONTRIBUTING guide.
Also, add tests and the respective documentation changes as well.
-->
<!-- If applied, this commit will... -->
This PR upgrades nFPM to v0.20.0, and integrates the new
`ConventionalExtension` method to use the correct extension for the
packaging format that is being used.
<!-- Why is this change being made? -->
Currently, goreleaser uses the name of the format to determine the
extension. This has worked fine, but with the introduction of Archlinux
packages, goreleaser has to handle packages with extensions that don't
match the name of the format, since Archlinux uses `.pkg.tar.zst` as the
extension.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
goreleaser/nfpm#546goreleaser/nfpm#543
Jailbroken iOS can install deb packages, and it seems the only change
needed is to set the OS to `ios` instead of `linux`.
Closes#3410
cc/ @blacktop
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Set MarkdownV2 as parse mode for Telegram announcer.
This allows for additional formatting in the announcement, such as
`code` or _italic_ sections. For details, see the official [Telegram Bot
API](https://core.telegram.org/bots/api#markdownv2-style).
If someone has the time (not added in this PR), I think it would be
great to add a field to the Telegram config for the parse mode. This
would allow setting a different parse mode than MarkdownV2, such as
HTML.
This fixes#3431.