(uploadURL, path string)
| 155 | } |
| 156 | |
| 157 | func uploadFile(uploadURL, path string) { |
| 158 | file, err := os.Open(path) |
| 159 | if err != nil { |
| 160 | log.Printf("Error: %s\n", err.Error()) |
| 161 | return |
| 162 | } |
| 163 | defer file.Close() |
| 164 | |
| 165 | size, err := fileSize(file) |
| 166 | if err != nil { |
| 167 | log.Printf("Error: %s\n", err.Error()) |
| 168 | return |
| 169 | } |
| 170 | |
| 171 | filename := filepath.Base(file.Name()) |
| 172 | log.Printf("Uploading %s...\n", filename) |
| 173 | body, err := doRequest("POST", uploadURL+"?name="+filename, "application/octet-stream", file, size) |
| 174 | if err != nil { |
| 175 | log.Printf("Error: %s\n", err.Error()) |
| 176 | } |
| 177 | |
| 178 | if debug { |
| 179 | log.Println("========= UPLOAD RESPONSE ===========") |
| 180 | log.Println(string(body[:])) |
| 181 | } |
| 182 | } |
| 183 | |
| 184 | // CreateRelease creates a Github Release, attaching the given files as release assets |
| 185 | // If a release already exist, up in Github, this function will attempt to attach the given files to it. |
no test coverage detected