git - 如何设置 GoReleaser 将 brew tap 推送到不同的存储库

标签 git go github github-actions goreleaser

我希望在私有(private) github 存储库上设置一个 github 操作脚本,该脚本将发布和 brew tap 推送到单独的公共(public) git 存储库。我创建了一个 .gorelease.yml 文件并指定了一个 brews 部分,如下所示:

brews:
- name: myrepo
  goarm: 6
  github:
    owner: myrepo
    name: homebrew-myrepo
  homepage: "https://myrepo.com"

.gorelease.yml 文件工作正常并成功构建了二进制文件。我还在 github 操作中为公共(public)存储库指定了 github token ,因此应该可以工作。

当我运行 github 操作时,出现此错误:

   fatal: no tag exactly matches '38d505213e445a673a34812929ff858595e1a887'
   ⚠️ No tag found for commit 38d5052. Snapshot forced
   ...
   • signing artifacts        
      • pipe skipped              error=artifact signing is disabled
   • docker images            
      • pipe skipped              error=docker section is not configured
   • publishing               
      • pipe skipped              error=publishing is disabled
   • release succeeded after 159.12s

我不明白为什么当前的 git 存储库是相关的。因为我正在推送到一个单独的存储库,所以这个脚本不应该检查该存储库上的标签(而不是当前的标签)吗?即使在这种情况下,我如何在每次推送时自动创建标签?

最佳答案

goreleaser 使用 semver 来确定版本,因此您必须以 v1.2.4 格式添加标签

git tag v1.2.4
git push --tags

.goreleaser.yml

brews:
  - github:
      owner: my-repo
      name: homebrew-myrepo
    folder: Formula
    homepage: https://github.com/my-repo/abc

工作流程文件

    - name: GoReleaser
      uses: goreleaser/goreleaser-action@v2
      with:
        version: latest
        args: release --rm-dist
      env:
        GITHUB_TOKEN: ${{ secrets.GR_TOKEN }}

注意:不要忘记创建一个新 token 并将其作为 secret 添加到相关存储库中。

关于git - 如何设置 GoReleaser 将 brew tap 推送到不同的存储库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60918957/

相关文章:

Github:在提交历史记录中显示标签

ruby - Git 找不到设置的 buildpack

用作结构字段或结构方法

http - 如何提供 CSS 文件并具有动态路由?

github - 源树无法推送

github - 查找在GitHub中删除了文件的提交(无克隆存储库)

带有扩展消息/描述的 Git/GitHub 提交

Git 与 master merge 而不 checkout 到 master

git - 检查两个分支中的哪个文件有较晚的提交

go - 为什么这个树行走功能会死锁?