Is there a configuration-free way to distribute a private go CLI?

44 views Asked by At

I have a CLI written with go within a private repository in an organization at Github. I want to distribute this CLI to other developers who have access to this repository.

I tried using goreleaser with a brew tap but it required extra configurations both for Formulas and for users to add their github token via machine github.com login. I want to know if there is a better way.

1

There are 1 answers

1
code_monk On

I think there is probably a better way.

You could include a .github/workflow/release.yaml file that looks like this:

name: Release MyBinaryName

on:
  release:
    types: [created]

jobs:
  releases-matrix:
    name: Release Go Binary
    runs-on: ubuntu-latest
    strategy:
      matrix:
        goos: [linux]
        goarch: [amd64]
    steps:
      - uses: actions/checkout@v2
      - uses: wangyoucao577/[email protected]
        with:
          github_token: ${{ secrets.GITHUB_TOKEN }}
          goos: ${{ matrix.goos }}
          goarch: ${{ matrix.goarch }}
          project_path: "."
          binary_name: "MyBinaryName"
          ldflags: "-s -w"
          extra_files: LICENSE README.md

It would then create downloadable assets whenever a new release is created in github.

More info on this specific github action here.

There are others like it, or you could write your own.