如何找到GitHub发布标签是否在git中预先发布?

时间:2016-07-15 09:42:07

标签: git github release

在github中创建发布时,我已经选中了预发布的复选框。因此,在发布页面中,此标记被标记为预发布。 (带红色标签)

现在我正在检查发布到本地的

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

现在我想知道该版本是否是本地计算机中的预发行版。 是否有这样做的命令?

enter image description here

2 个答案:

答案 0 :(得分:3)

GitHub版本是git标签之上的附加功能。与Pull Request,Issues和Forks相同,git中没有这样的概念。

创建发布时,将使用相同的名称创建新的git标记。但所有的属性,如

  • 发布名称
  • 描述
  • 预发布satus

附加到版本,而不是标签。

您可以轮询GitHub API以获取更多信息:

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

{
 ...
  "prerelease": false
}

您可以使用命令行包装器hub https://github.com/github/hub来隐藏http调用。

hub release show这样的命令应该适合你。

答案 1 :(得分:0)

以防万一您达到了速率限制(我正在一家大型软件商店工作),因此几乎不可能使用API​​请求(未经授权)。我的目标是检查是否将最新的稳定版本发布到我们的ci / cd管道中。

import java.awt.Point;
import java.io.Reader;
import javax.swing.JOptionPane;
import java.util.Random;

public class Room {
    private static int X; 
    private static int Y; 
    private static Point P; 
    private int[] coords;
    Random ranGen;

    public Room(String rstr) {
        StringSplitter S = new StringSplitter(rstr, " ");
        coords = S.getIntegers();
    }

    public Point getRandomPoint (Random ranGen) {
        return new Point(coords[0] +1 + ranGen.nextInt(coords[2] - coords[0] -2), (coords[1] +1 + ranGen.nextInt(coords[3] - coords[1] -2)));                                               
    }

    public String toString() {
        return "Room " + coords[0] + ", " + coords[1] + ", " + coords[2] + ", " + coords[3] + " Door " + coords[4] + ", " + coords[5];
    }

    public boolean IsInRoom(Point xy) {
        P = new Point (X,Y);

        return (xy.getX() > coords[0] && xy.getX() < coords[2] && xy.getY() > coords[1] && xy.getY() < coords[3]);
    }

    public static void main(String[] args) {
        Room r = new Room("0 0 5 5 0 2"); // create room
        System.out.println(r.toString()); // and print it

        String userIn = JOptionPane.showInputDialog
            (null, "please enter two coordinates one X and one Y separated by a space");
        JOptionPane.showMessageDialog(null, r.IsInRoom(P) + userIn);

        if (r.IsInRoom(P.getX() ) ) {
            System.out.println( (int) P.getX() + "," + (int) P.getY() + "Is in room");
        }
        else if (r.IsInRoom(P.getY() ) ){
            System.out.println((int) P.getX() + "," + (int) P.getY() + "Is in room");
        else (r.IsInRoom(P.getXY() ) ) { 
            System.out.println ((int) P.getX() + "," + (int) P.getY() + "Is not in room");
        }
    }
 }

因此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}) 成为最后一个发行版本,可用于签出代码。