mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-10 03:47:03 +02:00
fixed release upload
This commit is contained in:
parent
183c385e86
commit
1cdfd16d98
@ -58,6 +58,7 @@ func upload(ctx *context.Context, client client.Client, releaseID int, artifact
|
||||
return err
|
||||
}
|
||||
defer func() { _ = file.Close() }()
|
||||
log.WithField("file", file.Name()).Info("uploading")
|
||||
return client.Upload(ctx, releaseID, artifact, file)
|
||||
_, name := filepath.Split(path)
|
||||
log.WithField("file", file.Name()).WithField("name", name).Info("uploading to release")
|
||||
return client.Upload(ctx, releaseID, name, file)
|
||||
}
|
||||
|
@ -46,6 +46,8 @@ func TestRunPipe(t *testing.T) {
|
||||
assert.NoError(doRun(ctx, client))
|
||||
assert.True(client.CreatedRelease)
|
||||
assert.True(client.UploadedFile)
|
||||
assert.Contains("bin.deb", client.UploadedFileNames)
|
||||
assert.Contains("bin.tar.gz", client.UploadedFileNames)
|
||||
}
|
||||
|
||||
func TestRunPipeReleaseCreationFailed(t *testing.T) {
|
||||
@ -141,6 +143,7 @@ type DummyClient struct {
|
||||
FailToUpload bool
|
||||
CreatedRelease bool
|
||||
UploadedFile bool
|
||||
UploadedFileNames []string
|
||||
}
|
||||
|
||||
func (client *DummyClient) CreateRelease(ctx *context.Context, body string) (releaseID int, err error) {
|
||||
@ -160,5 +163,6 @@ func (client *DummyClient) Upload(ctx *context.Context, releaseID int, name stri
|
||||
return errors.New("upload failed")
|
||||
}
|
||||
client.UploadedFile = true
|
||||
client.UploadedFileNames = append(client.UploadedFileNames, name)
|
||||
return
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user