version: 2 project_name: hostsync # 构建前的准备工作 before: hooks: - go mod tidy - go generate ./... builds: - id: hostsync binary: "{{ .ProjectName }}" main: . env: - CGO_ENABLED=0 goos: - linux - windows - darwin goarch: - "386" - amd64 - arm - arm64 goarm: - "6" - "7" ignore: - goos: darwin goarch: "386" - goos: darwin goarch: arm - goos: windows goarch: arm ldflags: - -s -w - -X main.version={{ .Version }} - -X main.commit={{ .Commit }} - -X main.date={{ .Date }} - -X main.builtBy=goreleaser flags: - -trimpath upx: - enabled: true # 仅在需要时启用 UPX 压缩 # 注意:UPX 压缩可能会导致某些平台不兼容 # 需要确保 UPX 已安装并在 PATH 中 compress: best # 压缩级别,best 为最高压缩率 lzma: true # 打包配置 archives: - id: hostsync-archive name_template: "{{ .ProjectName }}-{{ .Version }}-{{ .Os }}-{{ .Arch }}{{ with .Arm }}v{{ . }}{{ end }}{{ with .Mips }}-{{ . }}{{ end }}{{ if not (eq .Amd64 \"v1\") }}{{ .Amd64 }}{{ end }}" formats: [binary] builds_info: mode: 0755 # 设置可执行文件权限 files: - LICENSE - readme.md - install.sh - install.ps1 checksum: name_template: "SHA256SUMS" algorithm: sha256 changelog: sort: asc filters: exclude: - "^docs:" - "^test:" - "^ci:" - "^chore:" - "^style:" groups: - title: "🚀 新功能" regexp: "^.*feat[(\\w)]*:+.*$" order: 0 - title: "🐛 Bug修复" regexp: "^.*fix[(\\w)]*:+.*$" order: 1 - title: "⚡ 性能优化" regexp: "^.*perf[(\\w)]*:+.*$" order: 2 - title: "📚 文档更新" regexp: "^.*docs[(\\w)]*:+.*$" order: 3 - title: "🔧 其他更新" order: 999 release: # 发布配置 - 强大的 Hosts 文件管理工具 name_template: "hostSync {{ .Tag }}" mode: replace header: | ## 快速安装 - **Linux/macOS**: ```bash curl -fsSL https://git.xykqyy.com/ljp/hostSync/raw/branch/main/install.sh | bash ``` - **Windows**: ```powershell irm "https://git.xykqyy.com/ljp/hostSync/raw/branch/main/install.ps1" | iex ``` - 📖 [完整文档](https://git.xykqyy.com/ljp/hostSync#readme) - 🐛 [问题反馈](https://git.xykqyy.com/ljp/hostSync/issues) - 💬 [讨论区](https://git.xykqyy.com/ljp/hostSync/discussions) > [!IMPORTANT] > **权限提醒**: 由于需要修改系统 hosts 文件,请确保以适当的权限运行程序。 > > - **Windows**: 以管理员身份运行 > - **Linux/macOS**: 使用 `sudo` 命令 > > 在 Linux/macOS 上,初始化后会将二进制文件安装到 `~/.hostsync/` 目录,并自动设置 PATH 环境变量。 > 在 Windows 上,初始化后会将二进制文件安装到 `%USERPROFILE%\.hostsync\` 目录,并自动设置 PATH 环境变量。 > > 如果需要卸载 HostSync,请手动删除 `~/.hostsync/` 或 `%USERPROFILE%\.hostsync\` 目录,并从 PATH 中移除相关路径。 prerelease: auto footer: | ## 📈 校验和信息 下载文件后,可以使用以下命令验证文件完整性: ```bash # 下载校验和文件 curl -L "https://git.xykqyy.com/ljp/hostSync/releases/download/{{ .Tag }}/SHA256SUMS" -o "SHA256SUMS" # 验证文件 (Linux/macOS) sha256sum -c SHA256SUMS # 验证文件 (Windows PowerShell) Get-FileHash .\{{ .ProjectName }}.exe -Algorithm SHA256 ``` **感谢使用 HostSync!** 🎉 如果您觉得这个工具有用,请给我们一个 ⭐ Star! gitea_urls: api: https://git.xykqyy.com/api/v1 download: https://git.xykqyy.com