Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

updating build process to add HEAD + M1 support, addressing #52 #55

Merged
merged 4 commits into from
Apr 16, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion .goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,10 +63,34 @@ brews:
folder: Formula
homepage: https://github.com/twitchdev/twitch-cli
description: CLI for Twitch's developer offerings
custom_block: |
if OS.mac? && Hardware::CPU.arm?
url "https://github.com/twitchdev/twitch-cli.git", tag: "{{ .Tag }}"
depends_on "go" => :build
end

head "https://github.com/twitchdev/twitch-cli.git", branch: "main"
head do
depends_on "go" => :build
end
install: |
v = version
if build.head?
v = "head"
ldflags = "-X main.buildVersion=#{v}"
system "go", "build", "-ldflags=#{ldflags}"
mv "twitch-cli", "twitch"
end

if OS.mac? && Hardware::CPU.arm?
ldflags = "-X main.buildVersion=#{v}"
system "go", "build", "-ldflags=#{ldflags}"
mv "twitch-cli", "twitch"
end

bin.install "twitch"
test: |
system "#{bin}/twitch -v"
system "#{bin}/twitch", "version"
license: Apache-2.0
archives:
- replacements:
Expand Down
9 changes: 9 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,15 @@ release:
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
twitch-cli:latest --rm-dist

test-release:
docker build . -t twitch-cli:latest
docker run --rm --privileged \
-v $$PWD:/go/src/github.com/twitchdev/twitch-cli \
-v /var/run/docker.sock:/var/run/docker.sock \
-w /go/src/github.com/twitchdev/twitch-cli \
-e GITHUB_TOKEN=${GITHUB_TOKEN} \
twitch-cli:latest --rm-dist --skip-publish --snapshot

build:
go build --ldflags "-X main.buildVersion=source"

Expand Down