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: add support for checksum generation for extra files #2406
Merged
caarlos0
merged 4 commits into
goreleaser:master
from
anGie44:f-checksum-generation-extra-files
Sep 2, 2021
Merged
Changes from 2 commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
8516691
feat: add support for checksum generation for extra files
anGie44 e06c69c
Merge remote-tracking branch 'upstream/master' into f-checksum-genera…
anGie44 ee9b841
Merge branch 'master' into f-checksum-generation-extra-files
caarlos0 aee046c
Merge branch 'master' into f-checksum-generation-extra-files
caarlos0 File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,6 +11,7 @@ import ( | |
|
||
"github.com/apex/log" | ||
"github.com/goreleaser/goreleaser/internal/artifact" | ||
"github.com/goreleaser/goreleaser/internal/extrafiles" | ||
"github.com/goreleaser/goreleaser/internal/pipe" | ||
"github.com/goreleaser/goreleaser/internal/semerrgroup" | ||
"github.com/goreleaser/goreleaser/internal/tmpl" | ||
|
@@ -55,6 +56,22 @@ func (Pipe) Run(ctx *context.Context) (err error) { | |
return nil | ||
} | ||
|
||
extraFiles, err := extrafiles.Find(ctx.Config.Checksum.ExtraFiles) | ||
if err != nil { | ||
return err | ||
} | ||
|
||
for name, path := range extraFiles { | ||
if _, err := os.Stat(path); os.IsNotExist(err) { | ||
return fmt.Errorf("failed to checksum %s: %w", name, err) | ||
} | ||
Comment on lines
+65
to
+67
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this check is not needed I think, the |
||
artifactList = append(artifactList, &artifact.Artifact{ | ||
Name: name, | ||
Path: path, | ||
Type: artifact.UploadableFile, | ||
}) | ||
} | ||
|
||
g := semerrgroup.New(ctx.Parallelism) | ||
sumLines := make([]string, len(artifactList)) | ||
for i, artifact := range artifactList { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could you add a test trying to add a path that don't exist so we cover this branch too?