Skip to content

Commit af4a194

Browse files
committed
updating build process to add HEAD + M1 support, addressing #52
1 parent dfadd34 commit af4a194

File tree

2 files changed

+34
-1
lines changed

2 files changed

+34
-1
lines changed

.goreleaser.yml

+25-1
Original file line numberDiff line numberDiff line change
@@ -63,10 +63,34 @@ brews:
6363
folder: Formula
6464
homepage: https://github.com/twitchdev/twitch-cli
6565
description: CLI for Twitch's developer offerings
66+
custom_block: |
67+
if OS.mac? && Hardware::CPU.arm?
68+
url "https://github.com/twitchdev/twitch-cli.git", tag: "{{ .Tag }}"
69+
depends_on "go" => :build
70+
end
71+
72+
head "https://github.com/twitchdev/twitch-cli.git", branch: "main"
73+
head do
74+
depends_on "go" => :build
75+
end
6676
install: |
77+
v = version
78+
if build.head?
79+
v = "head"
80+
ldflags = "-X main.buildVersion=#{v}"
81+
system "go", "build", "-ldflags=#{ldflags}"
82+
mv "twitch-cli", "twitch"
83+
end
84+
85+
if OS.mac? && Hardware::CPU.arm?
86+
ldflags = "-X main.buildVersion=#{v}"
87+
system "go", "build", "-ldflags=#{ldflags}"
88+
mv "twitch-cli", "twitch"
89+
end
90+
6791
bin.install "twitch"
6892
test: |
69-
system "#{bin}/twitch -v"
93+
system "#{bin}/twitch", "version"
7094
license: Apache-2.0
7195
archives:
7296
- replacements:

Makefile

+9
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ release:
77
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
88
twitch-cli:latest --rm-dist
99

10+
test-release:
11+
docker build . -t twitch-cli:latest
12+
docker run --rm --privileged \
13+
-v $$PWD:/go/src/github.com/twitchdev/twitch-cli \
14+
-v /var/run/docker.sock:/var/run/docker.sock \
15+
-w /go/src/github.com/twitchdev/twitch-cli \
16+
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
17+
twitch-cli:latest --rm-dist --skip-publish --snapshot
18+
1019
build:
1120
go build --ldflags "-X main.buildVersion=source"
1221

0 commit comments

Comments
 (0)