Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Ship your CLI tool built by golang to your user #golangstudy

taichi nakashima
August 09, 2014
6.5k

Ship your CLI tool built by golang to your user #golangstudy

taichi nakashima

August 09, 2014
Tweet

Transcript

  1. ghr dmux https://github.com/tcnksm/dmux https://github.com/tcnksm/ghr - docker + tmux = dmux

    ! - Easy to ship your project on Github to your user cli-init https://github.com/tcnksm/cli-init - TheThe easy way to start building Golang CLI docc https://github.com/tcnksm/docc - docc open your project document ⋆ 100 ⋆ 38 ⋆ 39 ⋆ 7
  2. I built Cool CLI tool ! Make your life easy,

    Make you happy, Please use it !
  3. Tools • davecheney/golang-crosscompile • bash࣮૷ • laher/goxc • ߴػೳ (ύοέʔδϯά,

    bintray΁ͷΞοϓϩʔυ…) • mitchellh/gox • γϯϓϧ, ฒྻ࣮ߦ
  4. $ gox ! --> darwin/386: github.com/tcnksm/awesome --> darwin/amd64: github.com/tcnksm/awesome -->

    linux/386: github.com/tcnksm/awesome --> linux/amd64: github.com/tcnksm/awesome --> linux/arm: github.com/tcnksm/awesome --> freebsd/386: github.com/tcnksm/awesome --> freebsd/amd64: github.com/tcnksm/awesome --> openbsd/386: github.com/tcnksm/awesome
  5. $ gox \ -os="darwin linux windows" \ -arch="386 amd64" \

    -output "pkg/{{.OS}}_{{.Arch}}/{{.Dir}} " !
  6. $ echo “Releasing bintray with API” ! $ curl -T

    ${FILE.EXT} \ -u${USER}:${API_KEY} \ https://api.bintray.com/content/${USER}/${NAME}/${FILE}
  7. $ echo “Releasing Github with API” ! $ curl -X

    POST -H "Accept: application/vnd.github.v3+json" \ -H "Authorization: token ${GITHUB_TOKEN}" \ -H "Content-Type: ${CONTENT_TYPE}" \ --data-binary @“${ARCHIVE}" \ https://uploads.github.com/repos/${OWNER}/${REPO}/ releases/${RELEASE_ID}/assets?name=${ARCHIVE_NAME} \
  8. $ ghr v0.1.0 pkg/ ! --> Uploading: pkg/0.1.0_SHASUMS --> Uploading:

    pkg/ghr_0.1.0_darwin_386.zip --> Uploading: pkg/ghr_0.1.0_darwin_amd64.zip --> Uploading: pkg/ghr_0.1.0_linux_386.zip --> Uploading: pkg/ghr_0.1.0_linux_amd64.zip --> Uploading: pkg/ghr_0.1.0_windows_386.zip --> Uploading: pkg/ghr_0.1.0_windows_amd64.zip
  9. user • darwin_386.zip • darwin_amd64.zip • linux_386.zip • linux_amd64.zip …

    HerokuͱGithubΛ࢖ͬͨ౷Ұతͳπʔϧ഑෍ http://deeeet.com/writing/2014/08/07/github-heroku-dist/
  10. user curl -sL -A `uname -sp` redirect Detect platform HerokuͱGithubΛ࢖ͬͨ౷Ұతͳπʔϧ഑෍

    http://deeeet.com/writing/2014/08/07/github-heroku-dist/ • darwin_386.zip • darwin_amd64.zip • linux_386.zip • linux_amd64.zip …
  11. user curl -sL -A `uname -sp` redirect package Detect platform

    HerokuͱGithubΛ࢖ͬͨ౷Ұతͳπʔϧ഑෍ http://deeeet.com/writing/2014/08/07/github-heroku-dist/ • darwin_386.zip • darwin_amd64.zip • linux_386.zip • linux_amd64.zip …
  12. require "formula" ! class Ghr < Formula homepage "https://github.com/tcnksm/ghr" version

    'v0.1.1' url "https://github.com/tcnksm/ghr/releases/download/v0.1.1/ghr_v0.1.1_darwin_amd64.zip" sha1 “e5c793001f004b670df77cb57bc033c89201b485" ! depends_on :arch => :intel ! def install bin.install 'ghr' end end $ cat homebrew-ghr/ghr.rb