Skip to content

maxbeizer/gh-extension-template

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gh-extension-template

A template for building GitHub CLI extensions in Go.

Using this template

  1. Create a new repo from this template:

    gh repo create my-org/gh-my-extension --template maxbeizer/gh-extension-template --private --clone
    cd gh-my-extension
  2. Update these files:

    • go.mod — change the module path to your repo
    • Makefile — change EXTENSION_NAME to your extension name (without gh- prefix)
    • .goreleaser.yml — change project_name and binary to gh-<your-name>
    • main.go — change Use field and implement your commands
  3. Verify everything works:

    make ci
    make install-local
    gh my-extension

Development

make help          # see all targets
make build         # build binary
make test          # run tests
make ci            # build + vet + test-race
make install-local # install extension from checkout
make relink-local  # reinstall after changes

Releasing

Tag a version to trigger a release build:

git tag v0.1.0
git push origin v0.1.0

The GitHub Actions workflow uses goreleaser to build binaries for darwin/linux (amd64/arm64) and create a GitHub release. Once released, users install with:

gh extension install my-org/gh-my-extension

What's included

File Purpose
Makefile Build, test, lint, install targets
.goreleaser.yml Cross-platform binary releases
.github/workflows/release.yml Automated releases on tag push
.github/workflows/ci.yml CI on push/PR to main
main.go Minimal starter with cobra + signal handling
.gitignore Go/editor/OS ignores

About

Template repo for Go-based gh CLI extensions

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors