Skip to content

Commit

Permalink
rename 'make release' into 'make binaries'
Browse files Browse the repository at this point in the history
  • Loading branch information
aler9 committed Sep 17, 2022
1 parent 798a99d commit ef9902a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 19 deletions.
3 changes: 1 addition & 2 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
# do not add .git, since it is needed to extract the tag

/release
/binaries
6 changes: 3 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v2

- run: make release
- run: make binaries

- uses: actions/github-script@v6
with:
Expand All @@ -31,13 +31,13 @@ jobs:
});
const release_id = res.data.id;
for (const name of await fs.readdir('./release/')) {
for (const name of await fs.readdir('./binaries/')) {
await github.rest.repos.uploadReleaseAsset({
owner,
repo,
release_id,
name,
data: await fs.readFile(`./release/${name}`),
data: await fs.readFile(`./binaries/${name}`),
});
}
Expand Down
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@

/release
/binaries
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ help:
@echo " run run app"
@echo " test run tests"
@echo " lint run linter"
@echo " release build release assets for all platforms"
@echo " binaries build binaries for all platforms"
@echo ""

include scripts/*.mk
22 changes: 11 additions & 11 deletions scripts/release.mk → scripts/binaries.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,31 +5,31 @@ WORKDIR /s
COPY go.mod go.sum ./
RUN go mod download
COPY . ./
RUN make release-nodocker
RUN make binaries-nodocker
endef
export DOCKERFILE_RELEASE

release:
binaries:
echo "$$DOCKERFILE_RELEASE" | docker build . -f - -t temp \
&& docker run --rm -it -v $(PWD):/out \
temp sh -c "rm -rf /out/release && cp -r /s/release /out/"
&& docker run --rm -v $(PWD):/out \
temp sh -c "rm -rf /out/binaries && cp -r /s/binaries /out/"

release-nodocker:
binaries-nodocker:
$(eval VERSION := $(shell git describe --tags))
$(eval GOBUILD := go build -ldflags '-X "main.version=$(VERSION)"')
rm -rf release && mkdir release
rm -rf binaries && mkdir binaries

CGO_ENABLED=0 GOOS=windows GOARCH=amd64 $(GOBUILD) -o /tmp/mavp2p.exe
cd /tmp && zip -q $(PWD)/release/mavp2p_$(VERSION)_windows_amd64.zip mavp2p.exe
cd /tmp && zip -q $(PWD)/binaries/mavp2p_$(VERSION)_windows_amd64.zip mavp2p.exe

CGO_ENABLED=0 GOOS=linux GOARCH=amd64 $(GOBUILD) -o /tmp/mavp2p
tar -C /tmp -czf $(PWD)/release/mavp2p_$(VERSION)_linux_amd64.tar.gz --owner=0 --group=0 mavp2p
tar -C /tmp -czf $(PWD)/binaries/mavp2p_$(VERSION)_linux_amd64.tar.gz --owner=0 --group=0 mavp2p

CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=6 $(GOBUILD) -o /tmp/mavp2p
tar -C /tmp -czf $(PWD)/release/mavp2p_$(VERSION)_linux_arm6.tar.gz --owner=0 --group=0 mavp2p
tar -C /tmp -czf $(PWD)/binaries/mavp2p_$(VERSION)_linux_arm6.tar.gz --owner=0 --group=0 mavp2p

CGO_ENABLED=0 GOOS=linux GOARCH=arm GOARM=7 $(GOBUILD) -o /tmp/mavp2p
tar -C /tmp -czf $(PWD)/release/mavp2p_$(VERSION)_linux_arm7.tar.gz --owner=0 --group=0 mavp2p
tar -C /tmp -czf $(PWD)/binaries/mavp2p_$(VERSION)_linux_arm7.tar.gz --owner=0 --group=0 mavp2p

CGO_ENABLED=0 GOOS=linux GOARCH=arm64 $(GOBUILD) -o /tmp/mavp2p
tar -C /tmp -czf $(PWD)/release/mavp2p_$(VERSION)_linux_arm64.tar.gz --owner=0 --group=0 mavp2p
tar -C /tmp -czf $(PWD)/binaries/mavp2p_$(VERSION)_linux_arm64.tar.gz --owner=0 --group=0 mavp2p

0 comments on commit ef9902a

Please sign in to comment.