Skip to content

Commit

Permalink
don't re-push unchanged tags
Browse files Browse the repository at this point in the history
  • Loading branch information
deciduously committed Jan 9, 2025
1 parent 3113ffb commit a77e01e
Showing 1 changed file with 20 additions and 11 deletions.
31 changes: 20 additions & 11 deletions scripts/package_automation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -405,6 +405,7 @@ const checkAction = async (tangram: string, path: string): Promise<Result> => {
/** Perform the `publish` action for a package name. If the existing tag is out of date, tag and push the new package. */
const publishAction = async (tangram: string, name: string, path: string): Promise<Result> => {
log("publishing...");

// Check in the package, store the ID.
const packageIdResult = await checkinPackage(tangram, path);
if (packageIdResult.kind !== "ok") {
Expand All @@ -415,19 +416,27 @@ const publishAction = async (tangram: string, name: string, path: string): Promi
return result("checkinError", `no ID for ${path}`);
}

log(`tagging ${name}...`);
const tagResult = await tagPackage(tangram, name, path);
if (tagResult.kind !== "ok") {
return tagResult;
}
// Check if the tag already matches this ID.
let existing = await existingTaggedItem(tangram, name);

// Push the tag.
const pushTagResult = await push(tangram, name);
if (pushTagResult.kind !== "ok") {
return pushTagResult;
}
if (packageId === existing) {
log(`Existing tag for ${name} matches current ID:`, existing);
return ok(`${name} unchanged, no action taken.`);
} else {
log(`tagging ${name}...`);
const tagResult = await tagPackage(tangram, name, path);
if (tagResult.kind !== "ok") {
return tagResult;
}

// Push the tag.
const pushTagResult = await push(tangram, name);
if (pushTagResult.kind !== "ok") {
return pushTagResult;
}

return ok(`tagged ${name}: ${packageId}`);
return ok(`tagged ${name}: ${packageId}`);
}
};

/** Perform the upload action for a path. Will do the default build first. */
Expand Down

0 comments on commit a77e01e

Please sign in to comment.