{"id":19208676,"url":"https://github.com/heiwa4126/go-goreleaser1","last_synced_at":"2025-07-05T03:33:58.102Z","repository":{"id":62678802,"uuid":"561630792","full_name":"heiwa4126/go-goreleaser1","owner":"heiwa4126","description":"GoReleaserの練習","archived":false,"fork":false,"pushed_at":"2022-11-04T07:15:35.000Z","size":14,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-01-04T16:19:25.542Z","etag":null,"topics":["example","golang","goreleaser"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/heiwa4126.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-11-04T05:46:29.000Z","updated_at":"2022-11-04T07:16:26.000Z","dependencies_parsed_at":"2022-11-04T12:04:53.915Z","dependency_job_id":null,"html_url":"https://github.com/heiwa4126/go-goreleaser1","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fgo-goreleaser1","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fgo-goreleaser1/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fgo-goreleaser1/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/heiwa4126%2Fgo-goreleaser1/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/heiwa4126","download_url":"https://codeload.github.com/heiwa4126/go-goreleaser1/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":240280984,"owners_count":19776418,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["example","golang","goreleaser"],"created_at":"2024-11-09T13:27:23.676Z","updated_at":"2025-02-23T07:16:59.625Z","avatar_url":"https://github.com/heiwa4126.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# gorelaser1\n\n[GoReleaser](https://goreleaser.com/)の練習\n\n```\n$ goreleaser -v\ngoreleaser version 1.12.3\ncommit: e27e6a9e8c66ec5d2bbcafb1c047068bcf250269\nbuilt at: 2022-10-20T12:30:56Z\nbuilt by: goreleaser\ngoos: linux\ngoarch: amd64\nmodule version: v1.12.3, checksum: h1:sTJXdkGQO9eAP6pwEUazaD6ERJewZ7yzQexWEGPUVg4=\n\nhttps://goreleaser.com\n\n$ go version\ngo version go1.18.1 linux/amd64\n```\n\n[Quick Start](https://goreleaser.com/quick-start/)通りにやると動かない。\n\n\n```bash\nmkdir gorelaser1 ; cd gorelaser1\n```\n\n[Quick Start](https://goreleaser.com/quick-start/)にあるmain.goを作る。\n\n```bash\ngo mod init main\ngoreleaser init\ngoreleaser --snapshot --rm-dist\n# または (tar.gzは作ってくれない)\ngoreleaser build\n```\n\n`error=couldn't guess project_name, please add it to your config` とエラーが出るので、\n[Project Name](https://goreleaser.com/customization/project/)\nにある通り、`.goreleaser.yaml`の一番上のレベルに project_name を追加。\n\n再び\n```bash\ngoreleaser --snapshot --rm-dist\n```\n\nとりあえず./dist以下に tarballができた。\n\n- 386いらない -\u003e done\n- Macもいらない -\u003e done\n- tar.gzよりzipがいい -\u003e Windowsはzip, Linuxはtar.gzにした。\n\nここでいったんgitをinitial. goreleaserの作る.gitignoreは./distが入ってるだけなので、\n\n```bash\ncurl -L -o .gitignore https://www.toptal.com/developers/gitignore/api/go,visualstudiocode,emacs\n```\n\n`go build`した場合に備えて、最後に `gorelease1` を追加。\n\n...修正。ローカルで動かしてOKを確認。\n\n次。\nGitHubにpush。\n\n[Personal Access Tokens (Classic)](https://github.com/settings/tokens)\nでtoken。scopesはrepoだけでいいらしい。\n\n```bash\ngit commit -am 'xxxx'\ngit push\ngit tag v0.0.0\ngit push --tags\n\nexport GITHUB_TOKEN=gggggggggggggggggggggggggggggggggggggggg\ngoreleaser check\ngoreleaser --rm-dist\n```\n\nreleaseにLinux版とWindows版が追加された。\nGitHub Actionsなくてもここまでできるのか。\n\nGoバイナリのサイズを小さくしてみる。\n\n- upx - GitHub actionsだとインストールがいるかな...\n- ldflagsの-s -w と -trimpath\n\n\nGitHub Actionsつけてみる。\nおおむね\n[GitHub Actions - GoReleaser](https://goreleaser.com/ci/actions/?h=github+ac)\nのままで行けると思う。\n\n\u003e Dependencies file is not found in  Supported file pattern: go.sum\n\nとか言われて死ぬ。このプロジェクト依存ないんでgo.sumないんですけど...\nしょうがないので空ファイルつくる。依存あるなら`go mod tidy`\n\n```bash\n# いまつけたtagを消して\ngit --no-pager tag\ngit tag -d v0.0.2\ngit --no-pager tag\ngit ls-remote --tags\ngit push origin :refs/tags/v0.0.2\ngit ls-remote --tags\n# 空のgo.sumつくって\ntouch go.sum\n# もういちどpush\ngit add --all\ngit commit -am 'add empty go.sum for GitHub Actions'\ngit push\ngit tag v0.0.2\ngit push --tags\n```\n\nおお、うまくごまかせた。upxもちゃんと動いた。\n\ndebとrpmも作ってみたいのだがパラメータ多すぎて目が回る。\n[Linux packages (via nFPM) - GoReleaser](https://goreleaser.com/customization/nfpm/)\n\ngoreleaser自体の [.goreleaser.yaml](https://github.com/goreleaser/goreleaser/blob/main/.goreleaser.yaml) の\n`nfpms:`\nから\nコピペしてみる。\n\nローカルではあっさりできた。ちゃんとインストール・実行・アンインストールもできた。\n\n```bash\ngit commit -am 'add .rpm and .deb'\ngit push\ngit tag v0.0.3\ngit push --tags\n```\n\nおお出来た。あとはWindowsでMSIが出ればいいんだけど...\n[Packaging and uploading MSI installer for Windows · Issue #1295 · goreleaser/goreleaser](https://github.com/goreleaser/goreleaser/issues/1295)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fgo-goreleaser1","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fheiwa4126%2Fgo-goreleaser1","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fheiwa4126%2Fgo-goreleaser1/lists"}