Skip to content

Commit

Permalink
release binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
BennyThink committed Sep 14, 2022
1 parent d8648c5 commit 5ec1c7a
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: publish release
on:
push:
tags:
- "*"

jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
submodules: true

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Install Go
uses: actions/setup-go@v2
with:
go-version: 1.19

- name: Build binaries
run: |
make all
ls builds/
- name: Release files
uses: softprops/action-gh-release@v1
with:
files: builds/*
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,4 @@
# vendor/
/.idea/*
/coverage.txt
/builds/
32 changes: 28 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
OS = darwin linux windows
ARCH = amd64
ARCH = amd64 arm64
export DRIVER=$(shell which chromedriver)

default:
Expand All @@ -11,18 +11,42 @@ static:
CGO_ENABLED=0 go build -a -ldflags '-s -w -extldflags "-static"' .

all:
git pull
make clean
@echo "Build all platform executables..."
@for o in $(OS) ; do \
for a in $(ARCH) ; do \
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/DailyGakki-$$o-$$a .; \
done \
echo "Building $$o-$$a..."; \
if [ "$$o" = "windows" ]; then \
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/archiver-$$o-$$a.exe .; \
else \
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/archiver-$$o-$$a .; \
fi; \
done \
done

@make universal
@make checksum

clean:
@rm -rf builds
@rm -f archiver

test:
go test -v -coverprofile=coverage.txt -covermode=atomic

checksum: builds/*
@echo "Generating checksums..."
if [ "$(shell uname)" = "Darwin" ]; then \
shasum -a 256 $^ >> builds/checksum-sha256sum.txt ;\
else \
sha256sum $^ >> builds/checksum-sha256sum.txt; \
fi


universal:
@echo "Building macOS universal binary..."
docker run --rm -v $(shell pwd)/builds:/app/ bennythink/lipo-linux -create -output \
archiver-darwin-universal \
archiver-darwin-amd64 archiver-darwin-arm64

file builds/archiver-darwin-universal

0 comments on commit 5ec1c7a

Please sign in to comment.