Pages

Monday, 1 August 2022

Go-CLI-Template

 Golang CLI Template with GoReleaser github action.

With Github Actions CI flow to build your package as a release

Go CI kkdai - go-cli-template License

Made with Go

Installation

go get -u -x github.com/kkdai/go-cli-template

How To Use

go-cli-template --t="any test you want"  

Just clone it for your CLI program template.

Set up CI

Manual

Warning: this token will have access to write to all of your GitHub repos. Keep it secret!

Add a GitHub token to your repo's secrets.

[Settings] -> [Secrets] -> [New Secret]

That will be used at the end of release_build.

env:
  GITHUB_TOKEN: ${{ secrets.GO_RELEASER_GITHUB_TOKEN }}

Automated

For a safer and low-effort alternative, you can use a token that GitHub Actions generates for you on each run. You don't even have to generate or view this value and it is scoped to only work for the current repo, so it is much safer.

Change the end of release_build to use this instead:

env:
  GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
from https://github.com/kkdai/go-cli-template 

 

No comments:

Post a Comment