go-github-releaser

command module
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 20, 2025 License: MIT Imports: 20 Imported by: 0

README

go-github-releaser

Simple cli tool to cross-compile a go program, optionally sum, compress and cut a release to github.


[!TIP] This tool calls out to go but does the hashing and compression from standard lib only so it should be platform agnostic as well as small.

go install github.com/dearing/go-github-releaser@latest

Usage: go-github-releaser [options]
This tool was inspired from the tedious task of cross compiling go binaries and 
then uploading them to github. The md5, sha1, sha256, sha512, and zip options 
are available for each binary and will be named $out-dir/$name.$hash-mode.txt 
or $out-dir/$name.$hash-mode.zip. At release time, the entire contents of the 
out-dir will be uploaded to the github release. I recommend leaving draft as
true and editing the release on github from the url provided in the output. If
you find a mistake, you can delete the release and start over as it is a draft.

Everyday Steps:
  1) generate a new config file with 'go-github-releaser -init-config'
  2) edit the config file 'go-github-releaser.json' to your liking
  3) create the out-dir 'mkdir build' (this is a kind of safety check)
  4) run 'go-github-releaser' to build the artifacts
 
Release Steps:
  1) set GITHUB_TOKEN environment variable to a valid github token
  2) run 'go-github-releaser -cut-release' to build artifacts and upload assets

Tips:
  - bash 'export GITHUB_TOKEN=github_pat_abc123'
  - powershell '$env:GITHUB_TOKEN="github_pat_abc123"
  - cd build && sha1sum -c *.sha1.txt
  - to create a tag: 'git tag -a v1.1.3 -m "version 1.1.3"'
  - to get a commit-ish for a tag's target: 'git rev-list -n 1 tags/v1.1.3'

Options:

  -commit-ish string
        commit-ish to use for the release
  -config-file string
        config file to use (default "go-github-releaser.json")
  -cut-release
        cut a github release
  -init-config
        initialize a new config file and exit
  -skip-build
        skip the build step
  -version
        print the version and exit

example config
{
  "out-dir": "build",
  "src-dir": ".",
  "md5": false,
  "sha1": true,
  "sha256": false,
  "sha512": false,
  "zipFile": true,
  "github-owner": "dearing",
  "github-repos": "go-github-releaser",
  "release-tag": "v1.0.0",
  "release-name": "initial release",
  "release-body": "initial release of go-github-releaser",
  "release-draft": true,
  "release-prerelease": false,
  "release-commitish": "",
  "binaries": [
    {
      "name": "go-github-releaser-linux-amd64",
      "os": "linux",
      "arch": "amd64"
    },
    {
      "name": "go-github-releaser-darwin-amd64",
      "os": "darwin",
      "arch": "amd64"
    },
    {
      "name": "go-github-releaser-windows-amd64.exe",
      "os": "windows",
      "arch": "amd64"
    },
    {
      "name": "go-github-releaser-linux-arm64",
      "os": "linux",
      "arch": "arm64"
    },
    {
      "name": "go-github-releaser-darwin-arm64",
      "os": "darwin",
      "arch": "arm64"
    },
    {
      "name": "go-github-releaser-windows-arm64.exe",
      "os": "windows",
      "arch": "arm64"
    }
  ]
}

cross-compose list

$ go tool dist list
aix/ppc64
android/386
android/amd64
android/arm
android/arm64
darwin/amd64
darwin/arm64
dragonfly/amd64
freebsd/386
freebsd/amd64
freebsd/arm
freebsd/arm64
freebsd/riscv64
illumos/amd64
ios/amd64
ios/arm64
js/wasm
linux/386
linux/amd64
linux/arm
linux/arm64
linux/loong64
linux/mips
linux/mips64
linux/mips64le
linux/mipsle
linux/ppc64
linux/ppc64le
linux/riscv64
linux/s390x
netbsd/386
netbsd/amd64
netbsd/arm
netbsd/arm64
openbsd/386
openbsd/amd64
openbsd/arm
openbsd/arm64
openbsd/ppc64
openbsd/riscv64
plan9/386
plan9/amd64
plan9/arm
solaris/amd64
wasip1/wasm
windows/386
windows/amd64
windows/arm
windows/arm64

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL