From 8fa89667faed76096354a80943b2c7b13a489092 Mon Sep 17 00:00:00 2001 From: James Johns <192176108+jamesjohnsdev@users.noreply.github.com> Date: Thu, 18 Jun 2026 12:50:30 +1000 Subject: [PATCH 1/2] feat: add man page generation via cobra/doc MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds tools/gen-man and a Makefile with and targets. man/ is gitignored — generated at install time or in CI. --- .gitignore | 3 +++ Makefile | 9 +++++++++ cmd/root.go | 4 ++++ go.mod | 3 +++ go.sum | 3 +++ tools/gen-man/main.go | 27 +++++++++++++++++++++++++++ 6 files changed, 49 insertions(+) create mode 100644 Makefile create mode 100644 tools/gen-man/main.go diff --git a/.gitignore b/.gitignore index ff4c8bd..b7d3b9f 100644 --- a/.gitignore +++ b/.gitignore @@ -33,3 +33,6 @@ go.work.sum # Local issues data .issues/ + +# Generated man pages +man/ diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..780347c --- /dev/null +++ b/Makefile @@ -0,0 +1,9 @@ +MANDIR ?= /usr/local/share/man/man1 + +.PHONY: man install-man + +man: + go run ./tools/gen-man man + +install-man: man + install -Dm644 man/issues*.1 -t $(MANDIR) diff --git a/cmd/root.go b/cmd/root.go index 6e79d4b..0929d18 100644 --- a/cmd/root.go +++ b/cmd/root.go @@ -20,6 +20,10 @@ func Execute() { } } +func Root() *cobra.Command { + return rootCmd +} + func init() { bold := color.New(color.Bold).SprintFunc() cobra.AddTemplateFunc("bold", bold) diff --git a/go.mod b/go.mod index 54cf4cc..ad94faa 100644 --- a/go.mod +++ b/go.mod @@ -9,9 +9,12 @@ require ( ) require ( + github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect github.com/mattn/go-colorable v0.1.14 // indirect github.com/mattn/go-isatty v0.0.20 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/spf13/pflag v1.0.9 // indirect + go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/sys v0.42.0 // indirect ) diff --git a/go.sum b/go.sum index 489d6d6..7f631ce 100644 --- a/go.sum +++ b/go.sum @@ -1,3 +1,4 @@ +github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= github.com/fatih/color v1.19.0 h1:Zp3PiM21/9Ld6FzSKyL5c/BULoe/ONr9KlbYVOfG8+w= github.com/fatih/color v1.19.0/go.mod h1:zNk67I0ZUT1bEGsSGyCZYZNrHuTkJJB+r6Q9VuMi0LE= @@ -7,11 +8,13 @@ github.com/mattn/go-colorable v0.1.14 h1:9A9LHSqF/7dyVVX6g0U9cwm9pG3kP9gSzcuIPHP github.com/mattn/go-colorable v0.1.14/go.mod h1:6LmQG8QLFO4G5z1gPvYEzlUgJ2wF+stgPZH1UqBm1s8= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= +github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9 h1:9exaQaMOCwffKiiiYk6/BndUBv+iRViNW+4lEMi0PvY= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= +go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= diff --git a/tools/gen-man/main.go b/tools/gen-man/main.go new file mode 100644 index 0000000..55887a6 --- /dev/null +++ b/tools/gen-man/main.go @@ -0,0 +1,27 @@ +package main + +import ( + "log" + "os" + + "github.com/jamesjohnsdev/issues/cmd" + "github.com/spf13/cobra/doc" +) + +func main() { + dir := "man" + if len(os.Args) > 1 { + dir = os.Args[1] + } + if err := os.MkdirAll(dir, 0755); err != nil { + log.Fatal(err) + } + header := &doc.GenManHeader{ + Title: "ISSUES", + Section: "1", + Source: "issues", + } + if err := doc.GenManTree(cmd.Root(), header, dir); err != nil { + log.Fatal(err) + } +} From 9994d3e29ca56d08258db5e14bd2fac173d2baad Mon Sep 17 00:00:00 2001 From: James Johns <192176108+jamesjohnsdev@users.noreply.github.com> Date: Thu, 18 Jun 2026 13:03:37 +1000 Subject: [PATCH 2/2] ci: automated releases with goreleaser and release-please - automatic release notes + tag generation - automatic binary and .deb creation --- .github/workflows/goreleaser.yml | 31 ++++++++++++++++++ .github/workflows/release-please.yml | 18 +++++++++++ .goreleaser.yaml | 47 ++++++++++++++++++++++++++++ .release-please-manifest.json | 3 ++ release-please-config.json | 8 +++++ 5 files changed, 107 insertions(+) create mode 100644 .github/workflows/goreleaser.yml create mode 100644 .github/workflows/release-please.yml create mode 100644 .goreleaser.yaml create mode 100644 .release-please-manifest.json create mode 100644 release-please-config.json diff --git a/.github/workflows/goreleaser.yml b/.github/workflows/goreleaser.yml new file mode 100644 index 0000000..d3a5593 --- /dev/null +++ b/.github/workflows/goreleaser.yml @@ -0,0 +1,31 @@ +name: GoReleaser + +on: + push: + tags: + - "v*" + +permissions: + contents: write + +jobs: + goreleaser: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 + with: + fetch-depth: 0 + persist-credentials: false + + - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 + with: + go-version-file: go.mod + cache-dependency-path: go.sum + cache: false + + - uses: goreleaser/goreleaser-action@e435ccd777264be153ace6237001ef4d979d3a7a # v6 + with: + version: "~> v2" + args: release --clean + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release-please.yml b/.github/workflows/release-please.yml new file mode 100644 index 0000000..c24022d --- /dev/null +++ b/.github/workflows/release-please.yml @@ -0,0 +1,18 @@ +name: Release Please + +on: + push: + branches: [main] + +permissions: + contents: write + pull-requests: write + +jobs: + release-please: + runs-on: ubuntu-latest + steps: + - uses: googleapis/release-please-action@5c625bfb5d1ff62eadeeb3772007f7f66fdcf071 # v4 + with: + config-file: release-please-config.json + manifest-file: .release-please-manifest.json diff --git a/.goreleaser.yaml b/.goreleaser.yaml new file mode 100644 index 0000000..dc4a3c4 --- /dev/null +++ b/.goreleaser.yaml @@ -0,0 +1,47 @@ +version: 2 + +before: + hooks: + - make man + +builds: + - env: + - CGO_ENABLED=0 + goos: + - linux + - darwin + - windows + goarch: + - amd64 + - arm64 + ignore: + - goos: windows + goarch: arm64 + +archives: + - formats: + - tar.gz + format_overrides: + - goos: windows + formats: + - zip + files: + - man/*.1 + +nfpms: + - package_name: issues + homepage: https://github.com/jamesjohnsdev/issues + description: Local GitHub issue management + maintainer: James Johns <192176108+jamesjohnsdev@users.noreply.github.com> + license: MIT + formats: + - deb + contents: + - src: man/*.1 + dst: /usr/share/man/man1/ + +checksum: + name_template: checksums.txt + +changelog: + use: github diff --git a/.release-please-manifest.json b/.release-please-manifest.json new file mode 100644 index 0000000..e18ee07 --- /dev/null +++ b/.release-please-manifest.json @@ -0,0 +1,3 @@ +{ + ".": "0.0.0" +} diff --git a/release-please-config.json b/release-please-config.json new file mode 100644 index 0000000..ff6bc78 --- /dev/null +++ b/release-please-config.json @@ -0,0 +1,8 @@ +{ + "release-type": "go", + "bump-minor-pre-major": true, + "bump-patch-for-minor-pre-major": true, + "packages": { + ".": {} + } +}