diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 7c28bd7..0894d08 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -24,20 +24,6 @@ jobs: run: | make test build: - strategy: - matrix: - include: - - arch: amd64 - os: linux - - arch: arm64 - os: linux - - arch: riscv64 - os: linux - - arch: amd64 - os: darwin - - arch: arm64 - os: darwin - runs-on: ubuntu-latest steps: - name: Checkout code @@ -48,7 +34,7 @@ jobs: go-version-file: 'go.mod' - name: Build run: | - make build ARCH=${{ matrix.arch }} OS=${{ matrix.os }} + make build-all image: runs-on: ubuntu-latest steps: diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 88eb77c..2f9c7b6 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -6,7 +6,35 @@ on: - 'v*' jobs: - build-and-push: + build-binaries: + name: Build Binaries + runs-on: ubuntu-latest + steps: + - name: Checkout code + uses: actions/checkout@v4 + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version-file: 'go.mod' + - name: Build + run: | + make build-all + + - name: Create SHA256 checksum for files + run: | + for file in bin/*; do + sha256sum "$file" | awk '{ print $1 }' > "${file}.sha256" + done + - name: Create GitHub Release + id: create_release + uses: softprops/action-gh-release@v2 + with: + draft: false + prerelease: true + files: | + bin/* + + build-and-push-image: name: Build and Push Docker Image runs-on: ubuntu-latest diff --git a/Makefile b/Makefile index ed641c1..606b14c 100644 --- a/Makefile +++ b/Makefile @@ -18,6 +18,11 @@ TARGET ?= /usr/local/bin/$(CONTROLLER_NAME) IMAGE_NAME ?= aifoundryorg/oxide-controller +PLATFORMS ?= linux/amd64 linux/arm64 linux/riscv64 darwin/amd64 darwin/arm64 +CONTROLLERS := $(foreach plat,$(PLATFORMS),$(CONTROLLER_GENERIC)-$(subst /,-,$(plat))) + +build-all: $(CONTROLLERS) + build: $(CONTROLLER) install: build @@ -26,8 +31,8 @@ install: build $(BINDIR): @mkdir -p $@ -$(CONTROLLER): $(BINDIR) - @go build -o $@ ./cmd/ +$(CONTROLLER_GENERIC)-%: $(BINDIR) + @GOOS=$(word 1,$(subst -, ,$*)) GOARCH=$(word 2,$(subst -, ,$*)) go build -o $@ ./cmd/ link: $(CONTROLLER) $(CONTROLLER_GENERIC)