mandolyte / mdtopdf

Markdown to PDF
MIT License
133 stars 32 forks source link

Installing latest binary results with binary named "cmd", not "mdtopdf" #36

Closed mandolyte closed 1 year ago

mandolyte commented 1 year ago

@jessp01 - am I doing something wrong? Below is a transcript.

$ echo $GOBIN
/home/cecil/go/bin
$ go install github.com/mandolyte/mdtopdf/cmd@latest
$ mdtopdf -h
-bash: mdtopdf: command not found
$ ls $GOBIN
catcsv      csvq      gomodifytags  impl         reordercsv        staticcheck
cmd         dedupcsv  goplay        pivotcsv     simplehttpserver  transformcsv
comparecsv  diffcsv   gopls         recursecsv   sortcsv
convert     dlv       gotests       recursedata  splitcsv
$ cmd -h
Usage of cmd:
  -author string
        Author; used if -footer is passed
  -font-file string
        path to font file to use
  -font-name string
        Font name ID; e.g 'Helvetica-1251'
  -help
        Show usage message
  -i string
        Input filename or HTTP(s) URL; default is os.Stdin
  -new-page-on-hr
        Interpret HR as a new page; useful for presentations
  -o string
        Output PDF filename; required
  -orientation string
        [portrait | landscape] (default "portrait")
  -page-size string
        [A3 | A4 | A5] (default "A4")
  -s string
        Path to github.com/jessp01/gohighlight/syntax_files
  -theme string
        [light|dark] (default "light")
  -title string
        Presentation title
  -unicode-encoding string
        e.g 'cp1251'
  -with-footer
        Print doc footer (author  title  page number)
$ go install github.com/mandolyte/mdtopdf/cmd/mdtopdf@latest
go: github.com/mandolyte/mdtopdf/cmd/mdtopdf@latest: module github.com/mandolyte/mdtopdf@latest found (v1.5.0), but does not contain package github.com/mandolyte/mdtopdf/cmd/mdtopdf
$ 
jessp01 commented 1 year ago

Hi @mandolyte ,

You've done nothing wrong:) Please see https://github.com/mandolyte/mdtopdf/pull/37

With this, after issuing a new tag, the below should work:

$ go install github.com/mandolyte/mdtopdf/cmd/md2pdf@latest

I had to move cmd/md2pdf.go to cmd/md2pdf/md2pdf.go, otherwise, the binary is deployed to $GOBIN/cmd, which is not what we want.

jessp01 commented 1 year ago

Hi @mandolyte ,

I just tested following the release of v1.5.1 and it worked correctly so I reckon we can close this one. Also, would you be open to adding goreleaser as a GH action?

I can submit a pull but you'll need to set the GITHUB_TOKEN as a GH secret (see above doc).

Cheers,

mandolyte commented 1 year ago

@jessp01 - anything aside from signaling to https://pkg.go.dev/github.com/mandolyte/mdtopdf that there is a new release? Sort of feels like overkill to me. Thoughts?

jessp01 commented 1 year ago

@mandolyte ,

The advantage of using goreleaser is that it can produce binaries for multiple archs and GOOSes so that one doesn't need the go toolchain installed to deploy the application. You can have a look at the assets in https://github.com/jessp01/zaje/releases/tag/v0.21.4 for example.

Granted, installing golang on any modern OS is fairly easy but still, I reckon it's nice to be able to deploy the binaries without it.

mandolyte commented 1 year ago

@jessp01 OK, you convinced me. Go for it!

jessp01 commented 1 year ago

Hi @mandolyte ,

Just submitted https://github.com/mandolyte/mdtopdf/pull/38. It introduces a GH actions CI and a workflow for creating a package with Goreleaser upon tag creation.

Either way, I reckon we can close this particular issue as the go install github.com/mandolyte/mdtopdf/cmd/md2pdf@latest problem was resolved with commits included in the last tag.

Cheers,

mandolyte commented 1 year ago

I think I'll need some guidance on setting up the secret... looking at the github page at https://github.com/mandolyte/mdtopdf/settings/secrets/actions and not quite understanding what (if anything) needs to be done.

Thanks! Cecil

On Thu, Aug 3, 2023 at 3:54 PM Jesse Portnoy @.***> wrote:

Hi @mandolyte https://github.com/mandolyte ,

Just submitted #38 https://github.com/mandolyte/mdtopdf/pull/38. It introduces a GH actions CI and a workflow for creating a package with Goreleaser upon tag creation.

Either way, I reckon we can close this particular issue as the go install @.*** problem was resolved with commits included in the last tag.

Cheers,

— Reply to this email directly, view it on GitHub https://github.com/mandolyte/mdtopdf/issues/36#issuecomment-1664569024, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJ2ZXLWHG2FZINZZPATLTLXTP6WDANCNFSM6AAAAAA27VV4UU . You are receiving this because you were mentioned.Message ID: @.***>

jessp01 commented 1 year ago

Hi @mandolyte ,

Actually, you don't need to do anything as you've already merged my pull which includes .github/workflows/go.yml:) By doing so, secrets.GITHUB_TOKEN was already set.

So really, all you need to do now is create a tag as you normally would and check the log for the job that will be created here https://github.com/mandolyte/mdtopdf/actions