简体   繁体   English

如何在git中查找GitHub发布标签是否已预发布?

[英]How to find whether a GitHub release tag is pre-release in git?

While creating the release in github, i have checked the checkbox for pre-release. 在github中创建发行版时,我已经选中了预发行版复选框。 So in the releases page this tag is marked as pre-release. 因此,在发行页面中,此标记被标记为预发行。 (with a red color label) (带有红色标签)

now I am checking out the release to local a 现在我正在检查发布到本地

git fetch upstream
git checkout -b release-v1.0 release-v1.0

now I want to know if the release is a pre-release or not in the local machine. 现在,我想知道发行版是否为预发行版,或者是否在本地计算机中。 Is there a command for doing this this? 是否有执行此操作的命令?

在此处输入图片说明

GitHub Releases are an additional feature on top of git tags. GitHub版本是git标记之上的附加功能。 Same as for Pull Request, Issues, and Forks, there is no such concept in git. 与Pull Request,Issue和Forks一样,git中没有这样的概念。

When you create a release a new git tag will be created with the same name. 创建发行版时,将使用相同的名称创建一个新的git标签。 But all the properties like 但是所有的属性都一样

  • Release name 发布名称
  • Description 描述
  • Pre-release satus 发行前的饱和状态

Are attached to the release, not to the tag. 附加到版本,而不是标签。

You can poll GitHub API for an additional info: 您可以轮询GitHub API以获取其他信息:

GET /repos/:owner/:repo/releases/:id

{
 ...
  "prerelease": false
}

You can use command-line wrapper hub https://github.com/github/hub which will hide http calls for you. 您可以使用命令行包装器hub https://github.com/github/hub ,它将为您隐藏http调用。

Some commands like hub release show should work for you. 一些命令,如hub release show应该适合您。

Just in case if you hit the rate limit (I am working in a large software shop) so it's almost impossible to use API requests (without authorization). 万一您遇到速率限制(我正在一家大型软件商店工作),以致几乎不可能使用API​​请求(未经授权)。 My Goal was was to check is get the last stable release into our ci/cd pipeline. 我的目标是检查是否将最新的稳定版本发布到我们的ci / cd管道中。

function get_recent_stable_relese(){
    URL=$(curl -Ls -o /dev/null -w %{url_effective} $1)
    VERSION=$(basename ${URL})
    if [[ -z $VERSION ]]; then
        exit 1;
    fi
    echo $VERSION
    exit 0;
}

BOX_LATEST_RELEASE=http://github.com/box/box-content-preview/releases/latest
echo $(get_recent_stable_relese ${BOX_LATEST_RELEASE})

so latest becomes last release version which you can use to checkout code. 因此latest版本成为您可以用来签出代码的latest发行版本。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM