Skip to content
This repository has been archived by the owner on Jul 30, 2023. It is now read-only.

Add Goreleaser support for releases and homebrew #35

Merged
merged 6 commits into from
Nov 17, 2020

Conversation

rothgar
Copy link
Contributor

@rothgar rothgar commented Nov 11, 2020

WHAT

This adds a config for goreleaser to manually create releases via goreleaser release and also automatically via github actions when a new tag is pushed. I have an example in my fork and tap repo. brew install rothgar/tap/kubecolor works.

You'll need to create a github repo called dty1er/homebrew-tap/ and you'll need to create a GITHUB_TOKEN with access to push into that repo. You can read more about it here https://docs.github.com/en/free-pro-team@latest/actions/reference/authentication-in-a-workflow#using-the-github_token-in-a-workflow

You can create the token at https://github.com/settings/tokens It should only need repo access. If you want to use goreleaser to publish .rpm and .deb packages or docker containers you can also add package access.

You should make sure the token is set up in the repo settings as GITHUB_TOKEN so goreleaser can use it automatically.

Let me know if you run into problems or have questions. 馃憤

WHY

So releases are automatic and brew install works

Related issue

Fixes #27

@codecov-io
Copy link

codecov-io commented Nov 11, 2020

Codecov Report

Merging #35 (1e64fa6) into main (de74e2b) will not change coverage.
The diff coverage is n/a.

Impacted file tree graph

@@           Coverage Diff           @@
##             main      #35   +/-   ##
=======================================
  Coverage   84.26%   84.26%           
=======================================
  Files          16       16           
  Lines         521      521           
=======================================
  Hits          439      439           
  Misses         73       73           
  Partials        9        9           

Continue to review full report at Codecov.

Legend - Click here to learn more
螖 = absolute <relative> (impact), 酶 = not affected, ? = missing data
Powered by Codecov. Last update de74e2b...1e64fa6. Read the comment docs.

@hidetatz
Copy link
Owner

@rothgar
Hi, thanks a lot for sending this PR!
I'll try it out and make sure if it works as we expected.

- name: kubecolor
tap:
owner: dty1er
name: homebrew-tap
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

version: latest
args: release --rm-dist
env:
GITHUB_TOKEN: ${{ secrets.GO_RELEASER }}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a secret GO_RELEASER

image

uses: actions/setup-go@v1
with:
go-version: 1.13.x
- name: Docker login
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@rogh

Why do we need to do Docker login?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

oh woops, that was from another project. You don't. It's only if you want to create container images and push them to a registry. I'll remove.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you!

@hidetatz
Copy link
Owner

@rothgar
Thank you for the PR!
I will merge this and make sure this works.

@hidetatz hidetatz merged commit dc3c55d into hidetatz:main Nov 17, 2020
@hidetatz
Copy link
Owner

After running below, the GH action started: https://github.com/dty1er/kubecolor/runs/1410458503

git tag v0.0.7
git push origin v0.0.7

@hidetatz
Copy link
Owner

It successfully finished: https://github.com/dty1er/kubecolor/runs/1410458503

@hidetatz
Copy link
Owner

v0.0.7 release is made!
https://github.com/dty1er/kubecolor/releases/tag/v0.0.7

  • Changelog
  • Binary for each environment

Also, I downloaded the build binary for Darwin and made sure it works.

@hidetatz
Copy link
Owner

And homebrew-tap: https://github.com/dty1er/homebrew-tap/blob/master/Formula/kubecolor.rb

The formula is made.

@hidetatz
Copy link
Owner

I tried brew install dty1er/tap/kubecolor after removed current kubecolor under $GOPATH/bin.

~  $ type kubecolor
kubecolor is hashed (/usr/local/bin/kubecolor)

~  $ brew list kubecolor
/usr/local/Cellar/kubecolor/0.0.7/bin/kubecolor

~  $ brew info kubecolor
dty1er/tap/kubecolor: stable 0.0.7
Colorize your kubectl output
https://github.com/dty1er/kubecolor
/usr/local/Cellar/kubecolor/0.0.7 (5 files, 2.1MB) *
  Built from source on 2020-11-17 at 14:43:11
From: https://github.com/dty1er/homebrew-tap/blob/HEAD/Formula/kubecolor.rb
~  $ 

Made sure kubecolor installed via brew also works!

@hidetatz
Copy link
Owner

@rothgar

Thank you for your effort!
Now kubecolor gets much easier to install!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Installation without depending on go get
3 participants