mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
[REF] github page: move page to docs folder on master branch
Currently, some of the things on the playground must be changed directly on the master branch while other things require checking out the gh-pages branch and making the modifications there. Even when changes need to be made on the master branch, all changes that are not direcly in owl itself need to be copied by hand to the gh-pages branch. This commit moves all files that exist on the gh-pages branch to the master branch in the docs folder, this change will require configuring the github page to use the docs folder instead of a separate branch, but will make maintenance of the github page and playground easier going forward.
This commit is contained in:
committed by
Géry Debongnie
parent
9475de4d18
commit
b8b5190bc6
+40
-69
@@ -7,7 +7,6 @@ const chalk = require("chalk");
|
||||
const branchName = require('current-git-branch');
|
||||
|
||||
const REL_NOTES_FILE = `release-notes.md`;
|
||||
const STEPS = 8;
|
||||
const branch = "master";
|
||||
|
||||
const rl = readline.createInterface({
|
||||
@@ -29,26 +28,28 @@ async function startRelease() {
|
||||
logError(`You shall not pass! You are not on the ${branch} branch!`)
|
||||
return;
|
||||
}
|
||||
|
||||
log(`*** Owl release script ***`);
|
||||
log(`Current Version: ${package.version}`);
|
||||
|
||||
log("Check if code formatting is right...")
|
||||
const STEPS = 11;
|
||||
let step = 1;
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step ${step++}/${STEPS}: Checking if code formatting is right...`)
|
||||
const checkFormatting = await execCommand("npm run check-formatting");
|
||||
if (checkFormatting !== 0) {
|
||||
logError("Prettier format validation failed. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
log(`*** Owl release script ***`);
|
||||
log(`Current Version: ${package.version}`);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 1/${STEPS}: collecting info...`);
|
||||
log(`Step ${step++}/${STEPS}: collecting info...`);
|
||||
let next = await ask("Next version: ");
|
||||
if (next[0] === 'v') next = next.substring(1);
|
||||
let file = await ask(`Release notes (${REL_NOTES_FILE}): `);
|
||||
file = file || REL_NOTES_FILE;
|
||||
let content;
|
||||
if (!fs.existsSync(`./${file}`)) {
|
||||
let lastRelease = await getOutput("git log --grep='\\[REL\\]' -n 1 --pretty=%H");
|
||||
const lastRelease = await getOutput("git log --grep='\\[REL\\]' -n 1 --pretty=%H");
|
||||
const commitsSinceLastRelease = await getOutput(`git log ${lastRelease.trim()}..HEAD --pretty=%s`);
|
||||
const commitsAsMdList = commitsSinceLastRelease.trim().split("\n").map(l => " - " + l).join("\n");
|
||||
log(`${file} did not exist, created a template containing all commits since last release.`)
|
||||
@@ -59,6 +60,7 @@ async function startRelease() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
let content;
|
||||
try {
|
||||
content = await readFile("./" + file);
|
||||
} catch (e) {
|
||||
@@ -68,15 +70,12 @@ async function startRelease() {
|
||||
}
|
||||
let shouldBeDraft = await ask(`Should be a draft [y/n] ? (n)`);
|
||||
let draft = ""
|
||||
if (shouldBeDraft.toLowerCase() === 'y')
|
||||
{
|
||||
if (shouldBeDraft.toLowerCase() === 'y') {
|
||||
draft = "--draft";
|
||||
}
|
||||
let shouldUploadPlayground = await ask(`Should this release be uploaded on the playground [y/n] ? (y)`);
|
||||
shouldUploadPlayground = shouldUploadPlayground.toLowerCase() !== 'n';
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 2/${STEPS}: running tests...`);
|
||||
log(`Step ${step++}/${STEPS}: running tests...`);
|
||||
const testsResult = await execCommand("npm run test");
|
||||
if (testsResult !== 0) {
|
||||
logError("Test suite does not pass. Aborting.");
|
||||
@@ -84,28 +83,16 @@ async function startRelease() {
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 3/${STEPS}: updating package.json...`);
|
||||
await writeFile("package.json", JSON.stringify({...package, version: next}, null, 2) + "\n");
|
||||
await writeFile("package-lock.json", JSON.stringify({...packageLock, version: next}, null, 2) + "\n");
|
||||
await writeFile("./src/version.ts", `// do not modify manually. This file is generated by the release script.\nexport const version = "${next}";\n`);
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 4/${STEPS}: creating git commit...`);
|
||||
const escapedContent = content.replace(/\"/g, '\\\"').replace(/\`/g, '\\\`');
|
||||
const gitResult = await execCommand(`git commit -am "[REL] v${next}\n\n${escapedContent}"`);
|
||||
if (gitResult !== 0) {
|
||||
logError("Git commit failed. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
log(`Step 5/${STEPS}: building owl and devtools...`);
|
||||
log(`Step ${step++}/${STEPS}: building owl...`);
|
||||
await execCommand("rm -rf dist/");
|
||||
const buildResult = await execCommand("npm run build");
|
||||
if (buildResult !== 0) {
|
||||
logError("Build failed. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ----------------------------------------------------------------------------
|
||||
log(`Step ${step++}/${STEPS}: building devtools...`);
|
||||
const chromeResult = await execCommand("npm run build:devtools-chrome");
|
||||
if (chromeResult !== 0) {
|
||||
logError("Build devtools chrome failed. Aborting.");
|
||||
@@ -122,7 +109,27 @@ async function startRelease() {
|
||||
await execCommand("rm -r dist/devtools-chrome dist/devtools-firefox && rm dist/compiler.js");
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step 6/${STEPS}: pushing on github...`);
|
||||
log(`Step ${step++}/${STEPS}: updating package.json...`);
|
||||
await writeFile("package.json", JSON.stringify({...package, version: next}, null, 2) + "\n");
|
||||
await writeFile("package-lock.json", JSON.stringify({...packageLock, version: next}, null, 2) + "\n");
|
||||
await writeFile("./src/version.ts", `// do not modify manually. This file is generated by the release script.\nexport const version = "${next}";\n`);
|
||||
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step ${step++}/${STEPS}: updating owl on github page...`);
|
||||
await fs.copyFileSync("dist/owl.es.js", "docs/owl.js");
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step ${step++}/${STEPS}: creating git commit...`);
|
||||
const escapedContent = content.replace(/\"/g, '\\\"').replace(/\`/g, '\\\`');
|
||||
const gitResult = await execCommand(`git commit -am "[REL] v${next}\n\n${escapedContent}"`);
|
||||
if (gitResult !== 0) {
|
||||
logError("Git commit failed. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
log(`Step ${step++}/${STEPS}: pushing on github...`);
|
||||
const pushResult = await execCommand("git push origin " + branch);
|
||||
if (pushResult !== 0) {
|
||||
logError("git push failed. Aborting.");
|
||||
@@ -131,55 +138,19 @@ async function startRelease() {
|
||||
|
||||
// ---------------------------------------------------------------------------
|
||||
|
||||
log(`Step 7/${STEPS}: Creating the release...`);
|
||||
log(`Step ${step++}/${STEPS}: Creating the release...`);
|
||||
const relaseResult = await execCommand(`gh release create v${next} dist/*.js dist/*.zip ${draft} -F ${file}`);
|
||||
if (relaseResult !== 0) {
|
||||
logError("github release failed. Aborting.");
|
||||
return;
|
||||
}
|
||||
|
||||
log(`Step 8/${STEPS}: publishing module on npm...`);
|
||||
await execCommand("npm run publish");
|
||||
log(`Step ${step++}/${STEPS}: publishing module on npm...`);
|
||||
await execCommand("npm publish");
|
||||
|
||||
log("Owl Release process completed! Thank you for your patience");
|
||||
await execCommand(`gh release view`);
|
||||
await execCommand(`gh release view -w`);
|
||||
|
||||
if (shouldUploadPlayground) {
|
||||
log(`Bonus step: publishing new release on playground...`);
|
||||
let owl_code = null;
|
||||
let status = 0
|
||||
|
||||
try {
|
||||
owl_code = await readFile("dist/owl.iife.js");
|
||||
} catch (e) {
|
||||
logSubContent(e.message);
|
||||
logError("Cannot read owl.iife.js... Aborting");
|
||||
return;
|
||||
}
|
||||
|
||||
status |= await execCommand("git checkout gh-pages");
|
||||
status |= await execCommand("git pull --rebase");
|
||||
|
||||
if (status !== 0) {
|
||||
logError("Couldn't switch to gh-pages branch")
|
||||
return;
|
||||
}
|
||||
|
||||
try {
|
||||
fs.writeFileSync('owl.js', owl_code)
|
||||
} catch (err) {
|
||||
logError(err)
|
||||
return;
|
||||
}
|
||||
|
||||
status |= await execCommand(`git commit -am "[IMP] update owl to v${next}"`);
|
||||
status |= await execCommand(`git push origin gh-pages`);
|
||||
status |= await execCommand("git checkout -");
|
||||
if (status !== 0) {
|
||||
logError("Something went wrong for the playground update.")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user