goreleaser - 一键多平台打包工具 https://github.com/goreleaser/goreleaser/releases 下载goreleaser 创建一个go hello项目, > C:\Users\hanwei\Downloads\goreleaser_Windows_x86_64\goreleaser.exe init • Generating .goreleaser.yaml :\Users\hanwei\Downloads\goreleaser_Windows_x86_64\goreleaser.exe --snapshot --skip-publish --rm-dist \GitHub\example\goreleaser> C:\go\bin\goreleaser.exe --rm-dist • releasing >language-bash复制代码 goreleaser demo项目源码放在: https://github.com/backendcloud/example/tree/master/goreleaser
如果你经历过打rpm包的年代,你肯定对fpm不陌生,今天给大家介绍一个使用golang写的打deb和rpm包的工具,那就是nfpm,为什么要推荐,是因为可以通过goreleaser把程序直接输出rpm或 is Not FPM - a simple deb and rpm packager written in Go 如何安装(centos上) $ curl -sfL https://install.goreleaser.com /github.com/goreleaser/nfpm.sh | sh 如何使用(以官方demo演示) > nfpm init > tree . ├── bar ├── foo ├── foobar.conf 引用链接 [1] nfpm官网: https://nfpm.goreleaser.com/ [2] nfpm的GitHub: https://github.com/goreleaser/nfpm [3]
/replicatedhq/krew-plugin-template 推荐使用 GitHub Template 创建 Plugin 项目,该模板遵循最佳实践开发,并集成了一些简化开发流程的工具,使用 GoReleaser make bin 创建 Release 在完成代码逻辑和测试后,就可以将其发布到 github release 了,GitHub Action 和 GoReleaser[4] 会自动完成 Release uses: goreleaser/goreleaser-action@v1 with: version: latest args: release /kubernetes/cli-runtime/ [2] sample-cli-plugin: https://github.com/kubernetes/sample-cli-plugin [3] GoReleaser : https://goreleaser.com/ [4] GoReleaser: https://goreleaser.com/ [5] krew-index: https://github.com/
v0.1.x阶段做完了核心功能,通过GoReleaser交叉编译出macOSLinuxWindows的二进制,放到GitHubRelease上,用户curl|sh或brewinstall能装上。 所以GoReleaser配置拆成了两套:桌面版(macOS/Windows,CGO_ENABLED=1)和服务器版(Linux,纯Go编译)。 每一种安装方式背后都有对应的CI流水线在维护——GoReleaser管二进制+Homebrew+Scoop+deb/rpm包,Docker走单独的workflow,APT/YUM仓库也是独立的workflow 多架构Docker构建和推送docker/metadata-actionDocker标签自动生成nfpm不需要dpkg-deb也能打deb/rpm包(GoReleaser内置)GitHubPagesAPT 所有构建配置和CI脚本都在仓库里,可以直接参考:GoReleaser配置:.goreleaser.yamlDocker构建:Dockerfile+.github/workflows/docker.ymlAPT
3.1 使用clang编译 先贴一下workflow核心代码: - name: Build uses: goreleaser/goreleaser-action@v6 matrix.goarch }} CGO_ENABLED: 1 CC: /usr/bin/clang with: distribution: goreleaser /2.6.1/x64/goreleaser' failed with exit code 1 原因:在 Go runtime 尝试编译其 C 代码部分时,会默认使用当前 Ubuntu 系统中的 glibc - name: Build uses: goreleaser/goreleaser-action@v6 env: GOOS: ${{ /2.6.1/x64/goreleaser' failed with exit code 1 原因:同样的,sys/signalvar.h 是 FreeBSD 特有的系统头文件,它在 Ubuntu 系统中并不存在
tools.go 如下: // +build tools package tools import ( // _ "github.com/cosmtrek/air" // _ "github.com/goreleaser /goreleaser" _ "github.com/bufbuild/buf/cmd/buf" _ "github.com/grpc-ecosystem/grpc-gateway/v2/protoc-gen-grpc-gateway
TeamServer获取任务,发送给Agent •post_task 将接收到的内容发送给Client控制台 •download_file 接收文件保存tmp目录,其实就是文件下载 Agent生成逻辑 GoReleaser GoReleaser - Builds https://github.com/burrowers/garble # This is an example .goreleaser.yml file with # Make sure to check the documentation at https://goreleaser.com project_name exclude: - '^docs:' - '^test:' 这部分我采用了goreleaser = ["goreleaser", "build", "--snapshot", "--rm-dist", "--single-target"] env_variables
除此之外,我们还可以将该项目源码克隆至本地: git clone https://github.com/D00Movenok/BounceBack.git 然后安装goreleaser并手动构建项目代码即可 : goreleaser release --clean --snapshot 工具使用 首先,使用下列命令更新banned_ips.txt文件: bash scripts/collect_banned_ips.sh 项目地址 BounceBack: https://github.com/D00Movenok/BounceBack https://git-lfs.com/ https://goreleaser.com
安装 Go 二进制文件由GoReleaser随每个版本自动构建。这些可以在此项目的 GitHub发布页面上访问。 https://github.com/goreleaser/goreleaser https://github.com/robscott/kube-capacity/releases Homebrew
gnome-builder link-grammar pgcli youtube-dl blockhash goreleaser
cargo-release是一个类似于Go语言社区的一个分发工具GoReleaser。
shadowscatcher/shodan https://www.cloudreach.com/en/resources/blog/cts-build-golang-dockerfiles/ https://goreleaser.com
openimageio sfcgal qt ✔ cucumber-cpp goreleaser
GoReleaser GoReleaser 是一个通过多个库和通道来支持不同架构的 Go 项目自动化构建和发布的工具,这是面向不同平台 Go 项目的常见需求。 GoReleaser 能够用于每个发布版本的构建、打包、发布和声明,并且支持不同的包格式、包库和源代码控制的组合。虽然它已经出现好几年了,但我们惊讶并没有多少团队使用它。
一个真正的用 Golang 构建的可执行文件是可以在全平台运行的,前文中我们使用 goreleaser 发布了一个非常漂亮的 release 页面,并在 release 页面上提供多平台的可执行文件下载
五、CI/CD 与构建流程优化(ci / build) • 引入 goreleaser 实现自动构建与发布(9a3f361)。 • Docker 构建触发条件调整至仅在发布时执行(1516cb5)。
以下是安装 golangci-lint 推荐的两种方法: 将二进制文件安装在 (go env GOPATH)/bin/golangci-lint 目录下 curl-sfL https://install.goreleaser.com /bin/ 目录下 curl-sfL https://install.goreleaser.com/github.com/golangci/golangci-lint.sh | sh -s vX.Y.Z