1
0
mirror of https://github.com/goreleaser/goreleaser.git synced 2025-01-16 03:52:12 +02:00

feat(artifactory): publish source archives too, log when no archives found (#4586)

Logs when no artifacts were found, and also allow to publish source
archives.

refs https://github.com/orgs/goreleaser/discussions/4585

Signed-off-by: Carlos Alexandro Becker <caarlos0@users.noreply.github.com>
This commit is contained in:
Carlos Alexandro Becker 2024-01-29 16:29:49 -03:00 committed by GitHub
parent 917cae54f0
commit ee7a1e66ab
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 11 additions and 1 deletions

View File

@ -169,9 +169,9 @@ func Upload(ctx *context.Context, uploads []config.Upload, kind string, check Re
// - "binary": Upload only the raw binaries
switch v := strings.ToLower(upload.Mode); v {
case ModeArchive:
// TODO: should we add source archives here too?
filters = append(filters,
artifact.ByType(artifact.UploadableArchive),
artifact.ByType(artifact.UploadableSourceArchive),
artifact.ByType(artifact.LinuxPackage),
)
case ModeBinary:
@ -197,6 +197,9 @@ func Upload(ctx *context.Context, uploads []config.Upload, kind string, check Re
func uploadWithFilter(ctx *context.Context, upload *config.Upload, filter artifact.Filter, kind string, check ResponseChecker) error {
artifacts := ctx.Artifacts.Filter(filter).List()
if len(artifacts) == 0 {
log.Info("no artifacts found")
}
log.Debugf("will upload %d artifacts", len(artifacts))
g := semerrgroup.New(ctx.Parallelism)
for _, artifact := range artifacts {

View File

@ -243,6 +243,7 @@ func TestUpload(t *testing.T) {
{"deb", artifact.LinuxPackage},
{"bin", artifact.Binary},
{"tar", artifact.UploadableArchive},
{"tar.gz", artifact.UploadableSourceArchive},
{"ubi", artifact.UploadableBinary},
{"sum", artifact.Checksum},
{"sig", artifact.Signature},
@ -298,6 +299,7 @@ func TestUpload(t *testing.T) {
checks(
check{"/blah/2.1.0/a.deb", "u2", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar", "u2", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar.gz", "u2", "x", content, map[string]string{}},
),
},
{
@ -315,6 +317,7 @@ func TestUpload(t *testing.T) {
checks(
check{"/blah/2.1.0/a.deb", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar.gz", "u1", "x", content, map[string]string{}},
),
},
{
@ -331,6 +334,7 @@ func TestUpload(t *testing.T) {
checks(
check{"/blah/2.1.0/a.deb", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar.gz", "u1", "x", content, map[string]string{}},
),
},
{
@ -347,6 +351,7 @@ func TestUpload(t *testing.T) {
checks(
check{"/blah/2.1.0/linux/amd64/a.deb", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/linux/amd64/a.tar", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/linux/amd64/a.tar.gz", "u1", "x", content, map[string]string{}},
),
},
{
@ -364,6 +369,7 @@ func TestUpload(t *testing.T) {
checks(
check{"/blah/2.1.0/a.deb", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar", "u1", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar.gz", "u1", "x", content, map[string]string{}},
),
},
{
@ -435,6 +441,7 @@ func TestUpload(t *testing.T) {
checks(
check{"/blah/2.1.0/a.deb", "u3", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar", "u3", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.tar.gz", "u3", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.sum", "u3", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.sig", "u3", "x", content, map[string]string{}},
check{"/blah/2.1.0/a.pem", "u3", "x", content, map[string]string{}},