Skip to content

Commit

Permalink
Add multi arch support
Browse files Browse the repository at this point in the history
  • Loading branch information
Tzvonimir committed Apr 2, 2024
1 parent 6b3db6d commit 016d699
Show file tree
Hide file tree
Showing 2 changed files with 86 additions and 1 deletion.
85 changes: 85 additions & 0 deletions .github/workflows/release-1.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
name: Create Release

on:
push:
tags:
- 'v*'

jobs:
build-linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.4'

- name: Build Binary for Linux AMD64
run: |
make build GOARCH=amd64
tar -czvf "lda-linux-amd64.tar.gz" "lda"
make build GOARCH=arm64
tar -czvf "lda-linux-arm64.tar.gz" "lda"
- uses: actions/upload-artifact@v4
with:
name: lda-linux-amd64.tar.gz
path: lda-linux-amd64.tar.gz

- uses: actions/upload-artifact@v4
with:
name: lda-linux-arm64.tar.gz
path: lda-linux-arm64.tar.gz

build-macos:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: bufbuild/buf-setup-action@v1

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.21.4'

- name: Build Binary for macOS AMD64
run: |
make build GOARCH=amd64
tar -czvf "lda-darwin-amd64.tar.gz" "lda"
make build GOARCH=arm64
tar -czvf "lda-darwin-arm64.tar.gz" "lda"
- uses: actions/upload-artifact@v4
with:
name: lda-darwin-amd64.tar.gz
path: lda-darwin-amd64.tar.gz

- uses: actions/upload-artifact@v4
with:
name: lda-darwin-arm64.tar.gz
path: lda-darwin-arm64.tar.gz

create-release:
needs: [build-linux, build-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts/

- name: Create Release
uses: softprops/action-gh-release@v2
with:
files: |
artifacts/lda-darwin-arm64.tar.gz/lda-darwin-arm64.tar.gz
artifacts/lda-darwin-amd64.tar.gz/lda-darwin-amd64.tar.gz
artifacts/lda-linux-amd64.tar.gz/lda-linux-amd64.tar.gz
artifacts/lda-linux-arm64.tar.gz/lda-linux-arm64.tar.gz
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ all: build debug

## Build binary
build: proto
CGO_ENABLED=1 GOOS=$(UNAME) go build -a -tags netgo -ldflags="$(LDFLAGS)" -o "$(TARGET)" .
CGO_ENABLED=1 GOOS=$(UNAME) GOARCH=$(ARCH) go build -a -tags netgo -ldflags="$(LDFLAGS)" -o "$(TARGET)" .

## Install binary to GOPATH
install: proto
Expand Down

0 comments on commit 016d699

Please sign in to comment.