UNPKG

@dappnode/dappnodesdk

Version:

dappnodesdk is a tool to make the creation of new dappnode packages as simple as possible. It helps to initialize and publish in ethereum blockchain

27 lines 1.07 kB
import { Github } from "../../../../providers/github/Github.js"; import { isValidRelease } from "./isValidRelease.js"; export async function fetchGithubUpstreamVersion(repo) { try { const newVersion = await fetchGithubLatestTag(repo); if (!isValidRelease(newVersion)) { console.log(`This is not a valid release (probably a release candidate) - ${repo}: ${newVersion}`); return null; } console.log(`Fetch latest version(s) - ${repo}: ${newVersion}`); return newVersion; } catch (e) { console.error("Error fetching upstream repo versions:", e); throw e; } } async function fetchGithubLatestTag(repo) { const [owner, repoName] = repo.split("/"); const githubRepo = new Github({ owner, repo: repoName }); const releases = await githubRepo.listReleases(); const latestRelease = releases[0]; if (!latestRelease) throw Error(`No release found for ${repo}`); return latestRelease.tag_name; } //# sourceMappingURL=fetchGithubUpstreamVersion.js.map