[IMP] tools: pull playground before trying to publish

Previously, if you were not the last person to publish to the
playground, your playground branch would be behind the remote and trying
to push to it would fail.

This commit attempts to pull the changes before updating owl so that
even if you were not the last person to push to the playground, as long
as the pull is a fast-forward, publishing to the playground won't fail.

This commit also adapts some of the status number manipulation to use
bitwise or instead of addition, since return status code can be both
positive or negative and may cancel one another. Using bitwise or
ensures than any non-zero code will make the status non-zero and stay
that way.
This commit is contained in:
Samuel Degueldre
2023-01-23 12:28:29 +01:00
committed by Géry Debongnie
parent c30678f3ea
commit b2685b6709
+6 -5
View File
@@ -132,7 +132,7 @@ async function startRelease() {
if (shouldUploadPlayground) { if (shouldUploadPlayground) {
log(`Bonus step: publishing new release on playground...`); log(`Bonus step: publishing new release on playground...`);
let owl_code = null; let owl_code = null;
status = 0 let status = 0
try { try {
owl_code = await readFile("dist/owl.iife.js"); owl_code = await readFile("dist/owl.iife.js");
@@ -142,7 +142,8 @@ async function startRelease() {
return; return;
} }
status += await execCommand("git checkout gh-pages"); status |= await execCommand("git checkout gh-pages");
status |= await execCommand("git pull --rebase");
if (status !== 0) { if (status !== 0) {
logError("Couldn't switch to gh-pages branch") logError("Couldn't switch to gh-pages branch")
@@ -156,9 +157,9 @@ async function startRelease() {
return; return;
} }
status += await execCommand(`git commit -am "[IMP] update owl to v${next}"`); status |= await execCommand(`git commit -am "[IMP] update owl to v${next}"`);
status += await execCommand(`git push origin gh-pages`); status |= await execCommand(`git push origin gh-pages`);
status += await execCommand("git checkout -"); status |= await execCommand("git checkout -");
if (status !== 0) { if (status !== 0) {
logError("Something went wrong for the playground update.") logError("Something went wrong for the playground update.")
} }