Merge pull request 'fix: use filepath for attachment name to handle naming when running on windows' (#1) from myrqs/release-action:fix-paths into main
Reviewed-on: https://gitea.com/actions/release-action/pulls/1 Reviewed-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
commit
420984e082
5
main.go
5
main.go
@ -5,7 +5,6 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"net/http"
|
"net/http"
|
||||||
"os"
|
"os"
|
||||||
"path"
|
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
@ -153,7 +152,7 @@ func uploadFiles(ctx *gha.GitHubContext, c *gitea.Client, owner, repo string, re
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, attachment := range attachments {
|
for _, attachment := range attachments {
|
||||||
if attachment.Name == path.Base(file) {
|
if attachment.Name == filepath.Base(file) {
|
||||||
if _, err := c.DeleteReleaseAttachment(owner, repo, releaseID, attachment.ID); err != nil {
|
if _, err := c.DeleteReleaseAttachment(owner, repo, releaseID, attachment.ID); err != nil {
|
||||||
f.Close()
|
f.Close()
|
||||||
return fmt.Errorf("failed to delete release attachment %s: %w", file, err)
|
return fmt.Errorf("failed to delete release attachment %s: %w", file, err)
|
||||||
@ -163,7 +162,7 @@ func uploadFiles(ctx *gha.GitHubContext, c *gitea.Client, owner, repo string, re
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, _, err = c.CreateReleaseAttachment(owner, repo, releaseID, f, path.Base(file)); err != nil {
|
if _, _, err = c.CreateReleaseAttachment(owner, repo, releaseID, f, filepath.Base(file)); err != nil {
|
||||||
f.Close()
|
f.Close()
|
||||||
return fmt.Errorf("failed to upload release attachment %s: %w", file, err)
|
return fmt.Errorf("failed to upload release attachment %s: %w", file, err)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user