ci: stop using goreleaser to produce macOS binaries, make universal binary as separate .tar.gz

This commit is contained in:
Jarek Kowalski
2021-03-21 17:46:32 -07:00
parent 94b3544653
commit bcfba334da
4 changed files with 30 additions and 6 deletions

View File

@@ -8,7 +8,6 @@ builds:
- CGO_ENABLED=0
goos:
- linux
- darwin
- windows
goarch:
- amd64

View File

@@ -96,12 +96,18 @@ build-current-os-with-ui: html-ui
ifeq ($(GOOS)/$(CI),darwin/true)
# build a fat binary that runs on both AMD64 and ARM64, this will be embedded in KopiaUI
# and will run optimally on both architectures.
GOARCH=arm64 go build $(KOPIA_BUILD_FLAGS) -o dist/kopia_darwin_arm64/.kopia-arm64 -tags embedhtml
GOARCH=amd64 go build $(KOPIA_BUILD_FLAGS) -o dist/kopia_darwin_amd64/.kopia-amd64 -tags embedhtml
lipo -create -output dist/kopia_darwin_$(GOARCH)/kopia dist/kopia_darwin_arm64/.kopia-arm64 dist/kopia_darwin_amd64/.kopia-amd64
GOARCH=arm64 go build $(KOPIA_BUILD_FLAGS) -o dist/kopia_darwin_arm64/kopia -tags embedhtml
GOARCH=amd64 go build $(KOPIA_BUILD_FLAGS) -o dist/kopia_darwin_amd64/kopia -tags embedhtml
mkdir -p dist/kopia_darwin_universal
lipo -create -output dist/kopia_darwin_universal/kopia dist/kopia_darwin_arm64/kopia dist/kopia_darwin_amd64/kopia
ifneq ($(MACOS_SIGNING_IDENTITY),)
codesign -v --keychain $(MACOS_KEYCHAIN) -s $(MACOS_SIGNING_IDENTITY) --force dist/kopia_$(GOOS)_$(GOARCH)/kopia$(exe_suffix)
codesign -v --keychain $(MACOS_KEYCHAIN) -s $(MACOS_SIGNING_IDENTITY) --force dist/kopia_darwin_amd64/kopia
codesign -v --keychain $(MACOS_KEYCHAIN) -s $(MACOS_SIGNING_IDENTITY) --force dist/kopia_darwin_arm/kopia
codesign -v --keychain $(MACOS_KEYCHAIN) -s $(MACOS_SIGNING_IDENTITY) --force dist/kopia_darwin_universal/kopia
endif
tools/make-tgz.sh dist kopia-$(KOPIA_VERSION_NO_PREFIX)-macOS-x64 dist/kopia_darwin_amd64/kopia
tools/make-tgz.sh dist kopia-$(KOPIA_VERSION_NO_PREFIX)-macOS-arm64 dist/kopia_darwin_arm64/kopia
tools/make-tgz.sh dist kopia-$(KOPIA_VERSION_NO_PREFIX)-macOS-universal dist/kopia_darwin_universal/kopia
else
go build $(KOPIA_BUILD_FLAGS) -o dist/kopia_$(GOOS)_$(GOARCH)/kopia$(exe_suffix) -tags embedhtml
endif

View File

@@ -85,7 +85,7 @@
"category": "public.app-category.utilities",
"extraResources": [
{
"from": "../dist/kopia_darwin_amd64",
"from": "../dist/kopia_darwin_universal",
"to": "server",
"filter": [
"kopia"

19
tools/make-tgz.sh Executable file
View File

@@ -0,0 +1,19 @@
#!/bin/sh
set -e
output_dir=$1
basefname=$2
binary_file=$3
temp_dir=$(mktemp -d)
staging_dir="$temp_dir/$basefname"
mkdir -p "$staging_dir"
cp $binary_file $staging_dir
cp LICENSE $staging_dir
cp README.md $staging_dir
tar -C $temp_dir -cvz $basefname > $output_dir/$basefname.tar.gz
rm -rf "$temp_dir"
#rm -rf $output_file.staging
#mkdir -vp $output_file.staging/$bn
# cp -v $output_file