Skip to content

Commit

Permalink
fix(build): set arch in magefile
Browse files Browse the repository at this point in the history
  • Loading branch information
fionera committed Nov 25, 2024
1 parent e8f614b commit 8482824
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/package.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
sudo apt update && sudo apt -y install make pkg-config rubygems && sudo gem install fpm
- name: Build binary
run: VERSION=${PACKAGE_VERSION} GOARCH=${{ matrix.arch }} go run mage.go build
run: VERSION=${PACKAGE_VERSION} ARCH=${{ matrix.arch }} go run mage.go build

- name: Build package
run: |
Expand Down
8 changes: 7 additions & 1 deletion magefile.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"os"
"os/exec"
"path/filepath"
"runtime"

"github.com/magefile/mage/mg"
"github.com/magefile/mage/sh"
Expand Down Expand Up @@ -56,7 +57,12 @@ func Format() error {
}

func Build() error {
if err := sh.RunV("go", "build", "-o", "build/coraza-spoa"); err != nil {
arch := os.Getenv("ARCH")
if arch == "" {
arch = runtime.GOARCH
}

if err := sh.RunWith(map[string]string{"GOARCH": arch}, "go", "build", "-o", "build/coraza-spoa"); err != nil {
return err
}
return nil
Expand Down

0 comments on commit 8482824

Please sign in to comment.