fix(build): make release dry-run by default and remove darwin/amd64 target

Replace --dry-run (default false) with --we-are-go-for-launch (default
false) so `core build release` is safe by default. Remove darwin/amd64
from default build targets (arm64 only for macOS). Fix cmd_project.go
to use command context instead of context.Background().

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
Snider 2026-02-03 23:08:59 +00:00
parent e5e6908416
commit 22952d9b2c
9 changed files with 11 additions and 15 deletions

View file

@ -63,7 +63,7 @@ var buildCmd = &cobra.Command{
Short: i18n.T("cmd.build.short"),
Long: i18n.T("cmd.build.long"),
RunE: func(cmd *cobra.Command, args []string) error {
return runProjectBuild(buildType, ciMode, targets, outputDir, doArchive, doChecksum, configPath, format, push, imageName, noSign, notarize, verbose)
return runProjectBuild(cmd.Context(), buildType, ciMode, targets, outputDir, doArchive, doChecksum, configPath, format, push, imageName, noSign, notarize, verbose)
},
}

View file

@ -21,7 +21,7 @@ import (
)
// runProjectBuild handles the main `core build` command with auto-detection.
func runProjectBuild(buildType string, ciMode bool, targetsFlag string, outputDir string, doArchive bool, doChecksum bool, configPath string, format string, push bool, imageName string, noSign bool, notarize bool, verbose bool) error {
func runProjectBuild(ctx context.Context, buildType string, ciMode bool, targetsFlag string, outputDir string, doArchive bool, doChecksum bool, configPath string, format string, push bool, imageName string, noSign bool, notarize bool, verbose bool) error {
// Get current working directory as project root
projectDir, err := os.Getwd()
if err != nil {
@ -116,7 +116,6 @@ func runProjectBuild(buildType string, ciMode bool, targetsFlag string, outputDi
}
// Execute build
ctx := context.Background()
artifacts, err := builder.Build(ctx, cfg, buildTargets)
if err != nil {
if !ciMode {

View file

@ -14,10 +14,10 @@ import (
// Flag variables for release command
var (
releaseVersion string
releaseDraft bool
releasePrerelease bool
releaseDryRun bool
releaseVersion string
releaseDraft bool
releasePrerelease bool
releaseGoForLaunch bool
)
var releaseCmd = &cli.Command{
@ -25,12 +25,12 @@ var releaseCmd = &cli.Command{
Short: i18n.T("cmd.build.release.short"),
Long: i18n.T("cmd.build.release.long"),
RunE: func(cmd *cli.Command, args []string) error {
return runRelease(cmd.Context(), releaseDryRun, releaseVersion, releaseDraft, releasePrerelease)
return runRelease(cmd.Context(), !releaseGoForLaunch, releaseVersion, releaseDraft, releasePrerelease)
},
}
func init() {
releaseCmd.Flags().BoolVar(&releaseDryRun, "dry-run", false, i18n.T("cmd.build.release.flag.dry_run"))
releaseCmd.Flags().BoolVar(&releaseGoForLaunch, "we-are-go-for-launch", false, i18n.T("cmd.build.release.flag.go_for_launch"))
releaseCmd.Flags().StringVar(&releaseVersion, "version", "", i18n.T("cmd.build.release.flag.version"))
releaseCmd.Flags().BoolVar(&releaseDraft, "draft", false, i18n.T("cmd.build.release.flag.draft"))
releaseCmd.Flags().BoolVar(&releasePrerelease, "prerelease", false, i18n.T("cmd.build.release.flag.prerelease"))

View file

@ -108,7 +108,6 @@ func DefaultConfig() *BuildConfig {
Targets: []TargetConfig{
{OS: "linux", Arch: "amd64"},
{OS: "linux", Arch: "arm64"},
{OS: "darwin", Arch: "amd64"},
{OS: "darwin", Arch: "arm64"},
{OS: "windows", Arch: "amd64"},
},

View file

@ -188,7 +188,7 @@ func TestDefaultConfig_Good(t *testing.T) {
assert.Empty(t, cfg.Build.Env)
// Default targets cover common platforms
assert.Len(t, cfg.Targets, 5)
assert.Len(t, cfg.Targets, 4)
hasLinuxAmd64 := false
hasDarwinArm64 := false
hasWindowsAmd64 := false

View file

@ -233,7 +233,7 @@
"sdk.complete": "SDK generation complete",
"release.short": "Build, archive, and publish a release",
"release.long": "Build all targets, create archives, generate checksums, and publish to configured destinations. Requires .core/release.yaml configuration.",
"release.flag.dry_run": "Show what would be done without publishing",
"release.flag.go_for_launch": "Actually publish to configured targets (default: dry-run only)",
"release.flag.version": "Version to release (overrides config)",
"release.flag.draft": "Create as draft release",
"release.flag.prerelease": "Mark as pre-release",

View file

@ -210,7 +210,6 @@ func DefaultConfig() *Config {
Targets: []TargetConfig{
{OS: "linux", Arch: "amd64"},
{OS: "linux", Arch: "arm64"},
{OS: "darwin", Arch: "amd64"},
{OS: "darwin", Arch: "arm64"},
{OS: "windows", Arch: "amd64"},
},

View file

@ -161,7 +161,7 @@ func TestDefaultConfig_Good(t *testing.T) {
assert.Empty(t, cfg.Project.Repository)
// Default targets
assert.Len(t, cfg.Build.Targets, 5)
assert.Len(t, cfg.Build.Targets, 4)
hasLinuxAmd64 := false
hasDarwinArm64 := false
hasWindowsAmd64 := false

View file

@ -227,7 +227,6 @@ func buildArtifacts(ctx context.Context, cfg *Config, projectDir, version string
targets = []build.Target{
{OS: "linux", Arch: "amd64"},
{OS: "linux", Arch: "arm64"},
{OS: "darwin", Arch: "amd64"},
{OS: "darwin", Arch: "arm64"},
{OS: "windows", Arch: "amd64"},
}