Sync public tree to 13dc821
This commit is contained in:
parent
e2bc145f60
commit
1dad0df5c4
6 changed files with 101 additions and 21 deletions
|
|
@ -69,6 +69,38 @@ function remoteHead(remote) {
|
|||
return head && head.split(/\s+/)[0];
|
||||
}
|
||||
|
||||
function publicTreeAlreadyPushed(manifest) {
|
||||
return (
|
||||
(manifest.public_tree_publish && manifest.public_tree_publish.pushed === true) ||
|
||||
process.env.DISASMER_PUBLIC_TREE_ALREADY_PUSHED === "1"
|
||||
);
|
||||
}
|
||||
|
||||
function publicTreePushSource(manifest) {
|
||||
return manifest.public_tree_publish && manifest.public_tree_publish.pushed === true
|
||||
? "manifest"
|
||||
: "external-env";
|
||||
}
|
||||
|
||||
function publicRepoRemoteForManifest(manifest) {
|
||||
return (
|
||||
manifest.public_repo_url ||
|
||||
manifest.public_repo_remote ||
|
||||
process.env.DISASMER_PUBLIC_REPO_REMOTE ||
|
||||
process.env.DISASMER_PUBLIC_REPO_URL ||
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
function publicTreeCommitForManifest(manifest) {
|
||||
return (
|
||||
(manifest.public_tree_publish && manifest.public_tree_publish.commit) ||
|
||||
process.env.DISASMER_PUBLIC_TREE_COMMIT ||
|
||||
process.env.DISASMER_PUBLIC_RELEASE_TARGET ||
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
function envState(name) {
|
||||
return process.env[name] ? "set" : "unset";
|
||||
}
|
||||
|
|
@ -111,19 +143,23 @@ assert.strictEqual(
|
|||
);
|
||||
assert.strictEqual(manifest.source_tree_clean, true, "public release prep must start clean");
|
||||
assert.strictEqual(
|
||||
manifest.public_tree_publish && manifest.public_tree_publish.pushed,
|
||||
publicTreeAlreadyPushed(manifest),
|
||||
true,
|
||||
"filtered public tree must be pushed to Forgejo before release publication"
|
||||
);
|
||||
|
||||
const publicRepoRemote = manifest.public_repo_url || manifest.public_repo_remote;
|
||||
const publicRepoRemote = publicRepoRemoteForManifest(manifest);
|
||||
assert(publicRepoRemote, "manifest must record public repository URL or remote");
|
||||
const publicTreeCommit = publicTreeCommitForManifest(manifest);
|
||||
const remoteMain = remoteHead(publicRepoRemote);
|
||||
assert.strictEqual(
|
||||
remoteMain,
|
||||
manifest.public_tree_publish.commit,
|
||||
"Forgejo public repository main branch must match the prepared public tree commit"
|
||||
);
|
||||
assert(remoteMain, "Forgejo public repository main branch must be readable");
|
||||
if (publicTreeCommit) {
|
||||
assert.strictEqual(
|
||||
remoteMain,
|
||||
publicTreeCommit,
|
||||
"Forgejo public repository main branch must match the prepared public tree commit"
|
||||
);
|
||||
}
|
||||
|
||||
assert(Array.isArray(manifest.assets) && manifest.assets.length > 0, "manifest assets missing");
|
||||
const checksumAsset = manifest.assets.find((asset) => asset.name === "SHA256SUMS");
|
||||
|
|
@ -176,7 +212,8 @@ const report = {
|
|||
kind: "disasmer-public-release-dryrun-preflight",
|
||||
source_commit: currentSourceCommit,
|
||||
release_name: manifest.release_name,
|
||||
public_tree_commit: manifest.public_tree_publish.commit,
|
||||
public_tree_commit: publicTreeCommit || remoteMain,
|
||||
public_tree_push_source: publicTreePushSource(manifest),
|
||||
public_repo_url: publicRepoRemote,
|
||||
public_repo_remote_head: remoteMain,
|
||||
source_tree_clean: currentTreeStatus === "",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue