Skip to content

Commit 2f18174

Browse files
authored
do not build and upload release assets (#107)
Users can run go install to download and build the CLI -- posting release assets is unnecessary complexity.
1 parent d5d8552 commit 2f18174

File tree

1 file changed

+3
-106
lines changed

1 file changed

+3
-106
lines changed

releaser/make_release.go

Lines changed: 3 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@ import (
66
"fmt"
77
"log"
88
"os"
9-
"os/exec"
10-
"path/filepath"
119
"strings"
1210
"time"
1311

@@ -293,64 +291,8 @@ func (rm *ReleaseManager) DeleteRemoteTag(version string) error {
293291
return nil
294292
}
295293

296-
// BuildCLIBinaries builds CLI binaries for multiple architectures
297-
func (rm *ReleaseManager) BuildCLIBinaries(version string) ([]string, error) {
298-
// Define target platforms
299-
platforms := []struct {
300-
GOOS string
301-
GOARCH string
302-
name string
303-
}{
304-
{"linux", "amd64", "linux-amd64"},
305-
{"linux", "arm64", "linux-arm64"},
306-
{"darwin", "amd64", "darwin-amd64"},
307-
{"darwin", "arm64", "darwin-arm64"},
308-
{"windows", "amd64", "windows-amd64"},
309-
}
310-
311-
// Create output directory
312-
outputDir := "release-binaries"
313-
if err := os.MkdirAll(outputDir, 0755); err != nil {
314-
return nil, fmt.Errorf("failed to create output directory: %w", err)
315-
}
316-
317-
var binaries []string
318-
319-
for _, platform := range platforms {
320-
outputName := fmt.Sprintf("dbos-%s-%s", version, platform.name)
321-
if platform.GOOS == "windows" {
322-
outputName += ".exe"
323-
}
324-
outputPath := filepath.Join(outputDir, outputName)
325-
326-
fmt.Printf("Building CLI for %s/%s...\n", platform.GOOS, platform.GOARCH)
327-
328-
cmd := exec.Command("go", "build",
329-
"-ldflags", fmt.Sprintf("-X main.Version=%s", version),
330-
"-o", outputPath,
331-
"./dbos/cmd")
332-
333-
cmd.Env = append(os.Environ(),
334-
fmt.Sprintf("GOOS=%s", platform.GOOS),
335-
fmt.Sprintf("GOARCH=%s", platform.GOARCH),
336-
"CGO_ENABLED=0",
337-
)
338-
339-
output, err := cmd.CombinedOutput()
340-
if err != nil {
341-
return nil, fmt.Errorf("failed to build for %s/%s: %w\nOutput: %s",
342-
platform.GOOS, platform.GOARCH, err, output)
343-
}
344-
345-
binaries = append(binaries, outputPath)
346-
fmt.Printf("✓ Built %s\n", outputName)
347-
}
348-
349-
return binaries, nil
350-
}
351-
352294
// CreateGitHubRelease creates a GitHub release with CLI binaries
353-
func (rm *ReleaseManager) CreateGitHubRelease(version string, binaries []string) error {
295+
func (rm *ReleaseManager) CreateGitHubRelease(version string) error {
354296
ctx := context.Background()
355297

356298
v, err := semver.NewVersion(version)
@@ -366,7 +308,7 @@ func (rm *ReleaseManager) CreateGitHubRelease(version string, binaries []string)
366308
GenerateReleaseNotes: github.Ptr(true),
367309
}
368310

369-
createdRelease, _, err := rm.client.Repositories.CreateRelease(
311+
_, _, err = rm.client.Repositories.CreateRelease(
370312
ctx,
371313
rm.githubOwner,
372314
rm.githubRepo,
@@ -378,36 +320,6 @@ func (rm *ReleaseManager) CreateGitHubRelease(version string, binaries []string)
378320
}
379321

380322
fmt.Printf("✓ GitHub release %s created\n", version)
381-
382-
// Upload CLI binaries as release assets
383-
for _, binaryPath := range binaries {
384-
file, err := os.Open(binaryPath)
385-
if err != nil {
386-
fmt.Printf("Warning: failed to open binary %s: %v\n", binaryPath, err)
387-
continue
388-
}
389-
defer file.Close()
390-
391-
opts := &github.UploadOptions{
392-
Name: filepath.Base(binaryPath),
393-
}
394-
395-
_, _, err = rm.client.Repositories.UploadReleaseAsset(
396-
ctx,
397-
rm.githubOwner,
398-
rm.githubRepo,
399-
*createdRelease.ID,
400-
opts,
401-
file,
402-
)
403-
404-
if err != nil {
405-
fmt.Printf("Warning: failed to upload %s: %v\n", filepath.Base(binaryPath), err)
406-
} else {
407-
fmt.Printf("✓ Uploaded %s\n", filepath.Base(binaryPath))
408-
}
409-
}
410-
411323
return nil
412324
}
413325

@@ -477,24 +389,9 @@ func main() {
477389
log.Fatalf("Failed to create release branch: %v", err)
478390
}
479391

480-
// Build CLI binaries for multiple platforms
481-
fmt.Printf("\nBuilding CLI binaries...\n")
482-
binaries, err := rm.BuildCLIBinaries(version)
483-
if err != nil {
484-
// Rollback: delete the remote tag
485-
if deleteErr := rm.DeleteRemoteTag(version); deleteErr != nil {
486-
fmt.Printf("Warning: failed to cleanup remote tag %s: %v\n", version, deleteErr)
487-
}
488-
// Delete the local tag
489-
if deleteErr := rm.repo.DeleteTag(version); deleteErr != nil {
490-
fmt.Printf("Warning: failed to cleanup local tag %s: %v\n", version, deleteErr)
491-
}
492-
log.Fatalf("Failed to build CLI binaries: %v", err)
493-
}
494-
495392
// Create GitHub release with CLI binaries
496393
fmt.Printf("\nCreating GitHub release...\n")
497-
if err := rm.CreateGitHubRelease(version, binaries); err != nil {
394+
if err := rm.CreateGitHubRelease(version); err != nil {
498395
// Rollback: delete the remote tag
499396
if deleteErr := rm.DeleteRemoteTag(version); deleteErr != nil {
500397
fmt.Printf("Warning: failed to cleanup remote tag %s: %v\n", version, deleteErr)

0 commit comments

Comments
 (0)