diff --git a/main.go b/main.go index e87c6d7..56af857 100644 --- a/main.go +++ b/main.go @@ -24,11 +24,6 @@ func updateVersion(repoPath string, serviceName string) (string, error) { botToken := os.Getenv("BOT_TOKEN") chatid := os.Getenv("CHAT_ID") - if serviceName == "alaskartv" { - versionPath = fmt.Sprintf("%s/release.txt", repoPath) - bumpVersionTv(repoPath) - } - currentVersion, err := os.ReadFile(versionPath) if err != nil { return "", fmt.Errorf("failed to read version file: %w", err) @@ -50,6 +45,11 @@ func updateVersion(repoPath string, serviceName string) (string, error) { return string(jsonResponse), nil } + if serviceName == "alaskartv" { + versionPath = fmt.Sprintf("%s/release.txt", repoPath) + bumpVersionTv(repoPath) + } + os.WriteFile(versionPath, []byte(newVersion), 0644) cmds := [][]string{ {"git", "-C", repoPath, "add", "."}, @@ -83,7 +83,7 @@ func updateVersion(repoPath string, serviceName string) (string, error) { return "", fmt.Errorf("failed to marshal JSON: %w", err) } return string(jsonResponse), nil -} + } func bumpVersionTv(repoPath string) { filePath := fmt.Sprintf("%s/version.txt", repoPath)