Skip to content

Commit 5ec1c7a

Browse files
committed
release binaries
1 parent d8648c5 commit 5ec1c7a

3 files changed

Lines changed: 61 additions & 4 deletions

File tree

.github/workflows/release.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: publish release
2+
on:
3+
push:
4+
tags:
5+
- "*"
6+
7+
jobs:
8+
release:
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v2
13+
with:
14+
submodules: true
15+
16+
- name: Set up Docker Buildx
17+
uses: docker/setup-buildx-action@v1
18+
19+
- name: Install Go
20+
uses: actions/setup-go@v2
21+
with:
22+
go-version: 1.19
23+
24+
- name: Build binaries
25+
run: |
26+
make all
27+
ls builds/
28+
29+
- name: Release files
30+
uses: softprops/action-gh-release@v1
31+
with:
32+
files: builds/*

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,4 @@
1515
# vendor/
1616
/.idea/*
1717
/coverage.txt
18+
/builds/

Makefile

Lines changed: 28 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
OS = darwin linux windows
2-
ARCH = amd64
2+
ARCH = amd64 arm64
33
export DRIVER=$(shell which chromedriver)
44

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

1313
all:
14-
git pull
14+
make clean
1515
@echo "Build all platform executables..."
1616
@for o in $(OS) ; do \
1717
for a in $(ARCH) ; do \
18-
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/DailyGakki-$$o-$$a .; \
19-
done \
18+
echo "Building $$o-$$a..."; \
19+
if [ "$$o" = "windows" ]; then \
20+
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/archiver-$$o-$$a.exe .; \
21+
else \
22+
CGO_ENABLED=0 GOOS=$$o GOARCH=$$a go build -ldflags="-s -w" -o builds/archiver-$$o-$$a .; \
23+
fi; \
24+
done \
2025
done
2126

27+
@make universal
28+
@make checksum
2229

2330
clean:
2431
@rm -rf builds
2532
@rm -f archiver
2633

2734
test:
2835
go test -v -coverprofile=coverage.txt -covermode=atomic
36+
37+
checksum: builds/*
38+
@echo "Generating checksums..."
39+
if [ "$(shell uname)" = "Darwin" ]; then \
40+
shasum -a 256 $^ >> builds/checksum-sha256sum.txt ;\
41+
else \
42+
sha256sum $^ >> builds/checksum-sha256sum.txt; \
43+
fi
44+
45+
46+
universal:
47+
@echo "Building macOS universal binary..."
48+
docker run --rm -v $(shell pwd)/builds:/app/ bennythink/lipo-linux -create -output \
49+
archiver-darwin-universal \
50+
archiver-darwin-amd64 archiver-darwin-arm64
51+
52+
file builds/archiver-darwin-universal

0 commit comments

Comments
 (0)