This commit adds a `make_latest` boolean to the release configuration,
to allow signaling to GitHub if the release should be marked as latest.
Albeit being a boolean, the internal Go type is a string to allow
to distinguish an empty string (default behavior: `true`) from an
explicit `false`.
For more information around the GitHub API field, see
https://docs.github.com/en/rest/releases/releases?apiVersion=2022-11-28#create-a-release
I did not include the `legacy` option, to not adopt something which
appears to be scheduled for removal in the future.
In addition, I opted for `make_latest` over `latest` because the
option is only available for GitHub. Which keeps the latter key
reserved for e.g. future use of a config option which is used across
Git providers.
Fixes#4159
Signed-off-by: Hidde Beydals <hidde@hhh.computer>
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>
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>
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>
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>
pending https://github.com/invopop/jsonschema/pull/79 the jsonschema should also have the correct deprecated markings
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 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>
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.
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>
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>
We support `.tar.gz` since the beginning, and `.tar.xz` for a long time.
`.tgz` and `.txz` are just commonly used shorthands for the same
formats.
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>
<!--
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>
I have no idea why this never happened before... the lock was
ineffective in `artifacts.List`, which should have caused at least some
race condition at some point.
Anyway, got it once locally while working on another feature, and
couldn't believe my eyes.
Fixed, thank goodness!
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>
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>
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>
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>
this allows to template the owner, group and mtime in file infos inside
archives.
should help towards reproducible builds!
goes well with #3618
Signed-off-by: Carlos A 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... -->
fixes#3584
When following the reproduction steps in #3584 I now get the following
contents for the zip archive:
```
$ goreleaser --snapshot --skip-publish
...
$ (mkdir thezip && cd thezip && unzip ../dist/test_0.0.0-SNAPSHOT-none_darwin_amd64.zip) && ls -lR thezip
Archive: ../dist/test_0.0.0-SNAPSHOT-none_darwin_amd64.zip
inflating: a/x -> ../x
inflating: a/x2 -> x
inflating: x
inflating: test
finishing deferred symbolic links:
a/x -> ../x
a/x2 -> x
total 1640
drwxr-xr-x 4 orawlings staff 128 Nov 22 16:19 a
-rwxr-xr-x 1 orawlings staff 833104 Nov 22 16:19 test
-rw-r--r-- 1 orawlings staff 2 Nov 22 15:32 x
thezip/a:
total 0
lrwxr-xr-x 1 orawlings staff 4 Nov 22 16:19 x -> ../x
lrwxr-xr-x 1 orawlings staff 1 Nov 22 16:19 x2 -> x
```
<!-- Why is this change being made? -->
I'm using goreleaser for a project that packages multiple binaries in
zip archives. We also include symlinks within the zip archives to give
some of the binaries an alternate (usually shorter) spelling so they are
easier to invoke on the command line.
This brings the zip archive behavior regarding symlinks in line with
tar.gz and tar archives.
<!-- # Provide links to any relevant tickets, URLs or other resources
-->
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 should prevent yamlschema from complaining on some fields that
accept an integer or string (goarm) and a bool or string (skip*)
Signed-off-by: Carlos A 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?
<!--
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#3407
Signed-off-by: Sheridan C Rawlins <scr@yahooinc.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Sheridan C Rawlins <scr@yahooinc.com>
this allows the user to specify the abbrev lenght to use, and will also add the option to omit the commit hash altogether by setting it to -1.
default is doing nothing
closes#3348
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
`--add-file` adds only the `--prefix` joined with the basename of the added file, so, adding a folder like `vendor` would break havoc.
this basically writes our own source archives (which are more compressed) and allows to add an entire folder easily, as well as other mappings as `archives` already supports.
refs #3102#2911
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
We should not imply the target_commitish, as some users might want to
have the code in one repo and the releases in another (e.g. private
code, public releases), so the commit might not be there.
We should instead allow the user to set the `target_commitish` (or not),
and pass it down to the github api.
refs 95bba02211
refs #3044
refs #3330
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* feat: add version for homebrew dependencies
* resolve conflicts
* resolve conflicts
* feat: allow to specify version of brew deps
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* docs: brew
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Co-authored-by: Purushotham <purushotham@hasura.io>
* feat: remove gofish
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: remove more unused code
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: remove more references
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* feat: strip_parent_binary_folder
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* docs: clarify dir
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* fix: fmt
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
Signed-off-by: Carlos A Becker <caarlos0@users.noreply.github.com>
* Support mTLS with client certificate when configured.
* Fix the omitempty typo.
* Add check for missing cert as well.
* Added documentation for artifactory and upload, as well as how to run mkdocs locally
* set pip version to just 3.
* Added example to the full config.
* Remove the Pipfile and update documentation to mention the task.
* update language in doc about multiarch images.
Co-authored-by: Sheridan C Rawlins <scr@ouryahoo.com>