Commit e8c0e0c3 authored by GeorgeMac's avatar GeorgeMac

Fixing bad relative urls

parent a0501e46
......@@ -2,8 +2,8 @@ package main
import (
"encoding/json"
"fmt"
"log"
"net/url"
"os"
"path"
"path/filepath"
......@@ -11,19 +11,16 @@ import (
"source.ind.ie/project/pulse/internal/upgrade"
)
func release(host *url.URL, version string, paths []string) []upgrade.Release {
func release(host, version string, paths []string) []upgrade.Release {
rel := upgrade.Release{
Tag: version,
Prerelease: false,
}
for _, pth := range paths {
target, err := host.Parse(path.Join("latest", pth))
if err != nil {
log.Fatal(err)
}
target := fmt.Sprintf("%s/%s", host, path.Join("latest", pth))
rel.Assets = append(rel.Assets, upgrade.Asset{
Name: pth,
URL: target.String(),
URL: target,
})
}
return []upgrade.Release{rel}
......@@ -36,12 +33,7 @@ func main() {
host, ver := os.Args[1], os.Args[2]
u, err := url.Parse(host)
if err != nil {
log.Fatal(err)
}
log.Printf("Releasing to %s version %s", u, ver)
log.Printf("Releasing to %s version %s", host, ver)
tar, err := filepath.Glob("*.tar.gz")
if err != nil {
......@@ -60,7 +52,7 @@ func main() {
log.Fatal(err)
}
if err := json.NewEncoder(fi).Encode(release(u, ver, paths)); err != nil {
if err := json.NewEncoder(fi).Encode(release(host, ver, paths)); err != nil {
log.Fatal(err)
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment