Skip to content

Commit 9a56e5f

Browse files
committed
ci: use makefile
1 parent c97c9b6 commit 9a56e5f

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

.github/workflows/release.yml

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -24,15 +24,13 @@ jobs:
2424

2525
- name: Build binaries
2626
run: |
27-
mkdir -p dist
28-
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} \
29-
go build -o dist/coldwire-server-${{ matrix.goos }}-${{ matrix.goarch }}
27+
make build BINARY_NAME=coldwire-server GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }}
3028
3129
- name: Upload artifacts
3230
uses: actions/upload-artifact@v4
3331
with:
3432
name: binaries
35-
path: dist/*
33+
path: bin/*
3634

3735
release:
3836
runs-on: ubuntu-latest
@@ -45,15 +43,15 @@ jobs:
4543
uses: actions/download-artifact@v4
4644
with:
4745
name: binaries
48-
path: dist
49-
46+
path: bin
47+
5048
- name: Compute SHA256 checksums
5149
run: |
52-
echo "## Checksums" > dist/CHECKSUMS.md
53-
for f in dist/*; do
54-
sha256sum "$f" >> dist/CHECKSUMS.md
50+
echo "## Checksums" > bin/CHECKSUMS.md
51+
for f in bin/*; do
52+
sha256sum "$f" >> bin/CHECKSUMS.md
5553
done
56-
cat dist/CHECKSUMS.md
54+
cat bin/CHECKSUMS.md
5755
5856
- name: Extract latest changelog section
5957
id: changelog
@@ -65,8 +63,9 @@ jobs:
6563
6664
- name: Publish GitHub Release
6765
run: |
68-
gh release create "$GITHUB_REF_NAME" dist/* \
66+
gh release create "$GITHUB_REF_NAME" bin/* \
6967
--title "Release $GITHUB_REF_NAME" \
7068
--notes "$LATEST_NOTES"
7169
env:
7270
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
71+

Makefile

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,15 @@
11
BINARY_NAME = coldwire-server
22
BIN_DIR = bin
33

4+
GOOS ?= $(shell go env GOOS)
5+
GOARCH ?= $(shell go env GOARCH)
6+
47
.PHONY: build
58

69
build:
710
mkdir -p $(BIN_DIR)
11+
GOOS=$(GOOS) GOARCH=$(GOARCH) go build -o $(BIN_DIR)/$(BINARY_NAME)-$(GOOS)-$(GOARCH) ./cmd/server
12+
813
go build -o $(BIN_DIR)/$(BINARY_NAME) ./cmd/server
914

1015

0 commit comments

Comments
 (0)