-
Notifications
You must be signed in to change notification settings - Fork 26
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Write manifest multi upstream (#417)
* Write manifest for multi-upstream repos * Improve manifest update doc and format * Include all versions to update in multi-upstream repos * Bump schemas 0.1.19 and types 0.1.38 * Deprecate multi-upstream on upstreamVersion * Fix multi-upstream test * Keep previous comparison * Remove old comment * Rename getUpstreamVersionTag function * Add spacing * Unify upstream settings format * Create manifest upstream types * Bump types to 0.1.39 * Use types from @dappnode/types:0.1.39 * Only print settings if there are versions to update * Rename function to updateComposeUpstreamVersions * Add comment on build arg check * Separate manifest update
- Loading branch information
1 parent
f285e1e
commit 3e05b11
Showing
12 changed files
with
201 additions
and
208 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
src/commands/githubActions/bumpUpstream/github/fetchGithubUpstreamVersion.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { Github } from "../../../../providers/github/Github.js"; | ||
import { isValidRelease } from "./isValidRelease.js"; | ||
|
||
export async function fetchGithubUpstreamVersion(repo: string): Promise<string | null> { | ||
|
||
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: string): Promise<string> { | ||
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; | ||
|
||
} |
16 changes: 7 additions & 9 deletions
16
src/commands/githubActions/bumpUpstream/github/getBumpPrBody.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,15 @@ | ||
import { ComposeVersionsToUpdate } from "../types.js"; | ||
import { UpstreamSettings } from "../types.js"; | ||
|
||
export function getBumpPrBody(versionsToUpdate: ComposeVersionsToUpdate): string { | ||
export function getBumpPrBody(upstreamSettings: UpstreamSettings[]): string { | ||
return [ | ||
"Bumps upstream version", | ||
Object.entries(versionsToUpdate) | ||
.map(([repoSlug, { newVersion, currentVersion }]) => | ||
`- [${repoSlug}](${getGitHubUrl({ repoSlug })}) from ${currentVersion} to [${newVersion}](${getGitHubUrl({ repoSlug, tag: newVersion })})` | ||
) | ||
.join("\n") | ||
upstreamSettings.flatMap(({ repo, githubVersion, manifestVersion }) => | ||
`- [${repo}](${getGitHubUrl({ repo })}) from ${manifestVersion} to [${githubVersion}](${getGitHubUrl({ repo, tag: githubVersion })})` | ||
).join("\n") | ||
].join("\n\n"); | ||
} | ||
|
||
function getGitHubUrl({ repoSlug, tag = "" }: { repoSlug: string, tag?: string }): string { | ||
const baseUrl = `https://github.com/${repoSlug}`; | ||
function getGitHubUrl({ repo, tag = "" }: { repo: string, tag?: string }): string { | ||
const baseUrl = `https://github.com/${repo}`; | ||
return tag ? `${baseUrl}/releases/tag/${tag}` : baseUrl; | ||
} |
12 changes: 6 additions & 6 deletions
12
src/commands/githubActions/bumpUpstream/github/getGithubSettings.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
15 changes: 0 additions & 15 deletions
15
src/commands/githubActions/bumpUpstream/github/getUpstreamVersionTag.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
export * from "./closeOldPrs.js"; | ||
export * from "./getBumpPrBody.js"; | ||
export * from "./getGithubSettings.js"; | ||
export * from "./getUpstreamVersionTag.js"; | ||
export * from "./isBranchNew.js"; | ||
export * from "./isValidRelease.js"; |
Oops, something went wrong.