diff options
| -rw-r--r-- | .github/workflows/release-please.yml | 7 | ||||
| -rw-r--r-- | magefile.go | 44 |
2 files changed, 46 insertions, 5 deletions
diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml index 023bad2..2556085 100644 --- a/.github/workflows/release-please.yml +++ b/.github/workflows/release-please.yml @@ -47,5 +47,10 @@ jobs: fail_on_unmatched_files: true tag_name: ${{ needs.release-please.outputs.tag_name }} files: | - build/rclone-studip + build/rclone-studip-darwin-amd64 + build/rclone-studip-darwin-arm64 + build/rclone-studip-linux-amd64 + build/rclone-studip-linux-arm64 + build/rclone-studip-windows-amd64.exe + build/rclone-studip-windows-arm64.exe build/librcloneplugin_backend_studip.so diff --git a/magefile.go b/magefile.go index a7fcdc0..506252b 100644 --- a/magefile.go +++ b/magefile.go @@ -243,12 +243,48 @@ func Standalone() error { return fmt.Errorf("create output dir %q: %w", outputDir, err) } - return runCommandWithEnv( - []string{"GOEXPERIMENT=" + goExperiment}, - "go", "build", "-o", binaryOutputPath(), ".", - ) + type target struct { + goos string + goarch string + } + + targets := []target{ + {goos: "linux", goarch: "amd64"}, + {goos: "linux", goarch: "arm64"}, + {goos: "windows", goarch: "amd64"}, + {goos: "windows", goarch: "arm64"}, + {goos: "darwin", goarch: "amd64"}, + {goos: "darwin", goarch: "arm64"}, + } + + for _, t := range targets { + out := binaryOutputPathFor(t.goos, t.goarch) + + env := []string{ + "GOEXPERIMENT=" + goExperiment, + "GOOS=" + t.goos, + "GOARCH=" + t.goarch, + "CGO_ENABLED=0", + } + + if err := runCommandWithEnv( + env, + "go", "build", "-o", out, ".", + ); err != nil { + return fmt.Errorf("build %s/%s: %w", t.goos, t.goarch, err) + } + } + + return nil } +func binaryOutputPathFor(goos, goarch string) string { + name := fmt.Sprintf("rclone-studip-%s-%s", goos, goarch) + if goos == "windows" { + name += ".exe" + } + return filepath.Join(outputDir, name) +} func RunStandalone(args ...string) error { if err := Standalone(); err != nil { return err |
