Skip to content

Commit

Permalink
add universal build for both Intel and Apple Silicon
Browse files Browse the repository at this point in the history
  • Loading branch information
YUX authored and konoui committed Mar 2, 2021
1 parent 98a3bb9 commit 4fc9010
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ jobs:
- name: set up go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
go-version: 1.16.x
- name: checkout
uses: actions/checkout@v2
- name: lint
Expand All @@ -29,7 +29,7 @@ jobs:
- name: set up go
uses: actions/setup-go@v2
with:
go-version: 1.14.x
go-version: 1.16.x
- name: checkout
uses: actions/checkout@v2
with:
Expand Down
9 changes: 6 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@ VERSION := $(shell git describe --tags --abbrev=0)
REVISION := $(shell git rev-parse --short HEAD)
SRC_DIR := ./
BIN_NAME := tldr
BINARY := bin/$(BIN_NAME)
BIN_DIR := bin
BINARY := $(BIN_DIR)/$(BIN_NAME)
ASSETS_DIR := assets
ASSETS := $(ASSETS_DIR)/* $(BINARY) README.md
ARTIFACT_DIR := .artifact
Expand Down Expand Up @@ -33,7 +34,9 @@ lint:

## Build macos binaries
darwin:
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS) -s -w" -o $(BINARY) $(SRC_DIR)
CGO_ENABLED=0 GOOS=darwin GOARCH=amd64 go build -ldflags "$(LDFLAGS) -s -w" -o $(BIN_DIR)/amd64 $(SRC_DIR)
CGO_ENABLED=0 GOOS=darwin GOARCH=arm64 go build -ldflags "$(LDFLAGS) -s -w" -o $(BIN_DIR)/arm64 $(SRC_DIR)
lipo -create $(BIN_DIR)/amd64 $(BIN_DIR)/arm64 -output $(BINARY)

## Run tests for my project
test:
Expand All @@ -57,7 +60,7 @@ release: package

## Clean Binary
clean:
rm -f $(BIN_NAME)
rm -f $(BIN_DIR)/*
rm -f $(ARTIFACT_DIR)/*


Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/konoui/alfred-tldr

go 1.14
go 1.16

require (
github.com/google/go-cmp v0.5.0
Expand Down

0 comments on commit 4fc9010

Please sign in to comment.