Exemple #1
0
func getLatestRelease(p db.Project) release {
	rel, res, etag := github.LatestRelease(p.Owner(), p.Repo(), p.LatestReleaseEtag)
	if res.HasError() {
		log.Println(res.Err)
		return release{p.LatestRelease.Tag, p.LatestRelease.HTMLURL, false}
	}

	if res.Response.StatusCode == http.StatusOK {
		db.SaveLatest(p.Name, rel.TagName, rel.HTMLURL, etag)
		return release{rel.TagName, rel.HTMLURL, false}
	}
	return release{p.LatestRelease.Tag, p.LatestRelease.HTMLURL, false}
}
Exemple #2
0
func getRcRelease(p db.Project) release {
	rel, res, etag := github.NextRcRelease(p.Owner(), p.Repo(), p.ReleasesEtag)
	if res.HasError() {
		log.Println(res.Err)
		return release{p.LatestRelease.Tag, p.LatestRelease.HTMLURL, true}
	}

	if rel == nil {
		return release{Tag: db.WIP}
	}

	if res.Response.StatusCode == http.StatusOK {
		db.SaveNextRcRelease(p.Name, rel.TagName, rel.HTMLURL, etag)
		return release{rel.TagName, rel.HTMLURL, true}
	}
	return release{p.NextPreRelease.Tag, p.NextPreRelease.HTMLURL, true}
}