cmd: containerd-release: abstract it out to create a new project

Signed-off-by: Antonio Murdaca <runcom@redhat.com>
This commit is contained in:
Antonio Murdaca
2017-10-30 15:10:41 +01:00
parent 1f704e9862
commit fa678a0937
4 changed files with 17 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ import (
"os"
"os/exec"
"runtime"
"strings"
)
func build() error {
@@ -18,10 +19,10 @@ func build() error {
return nil
}
const tarFormat = "containerd-%s.%s-%s.tar.gz"
const tarFormat = "%s-%s.%s-%s.tar.gz"
func tarRelease(tag string) (string, error) {
path := fmt.Sprintf(tarFormat, tag, runtime.GOOS, runtime.GOARCH)
func tarRelease(projectName, tag string) (string, error) {
path := fmt.Sprintf(tarFormat, strings.ToLower(projectName), tag, runtime.GOOS, runtime.GOARCH)
out, err := exec.Command("tar", "-zcf", path, "bin/").CombinedOutput()
if err != nil {
return "", fmt.Errorf("%s: %s", err, out)