mirror of
https://github.com/odoo/owl.git
synced 2025-10-06 19:59:41 +07:00
Improve the release script for easier deployment (#771)
Co-authored-by: Simon Genin (ges) <ges@odoo.com>
This commit is contained in:
@@ -121,8 +121,7 @@ npm install @odoo/owl
|
|||||||
|
|
||||||
If you want to use a simple `<script>` tag, the last release can be downloaded here:
|
If you want to use a simple `<script>` tag, the last release can be downloaded here:
|
||||||
|
|
||||||
- [owl-1.0.11.js](https://github.com/odoo/owl/releases/download/v1.0.11/owl.js)
|
- [owl-1.0.11](https://github.com/odoo/owl/releases/tag/v1.0.11)
|
||||||
- [owl-1.0.11.min.js](https://github.com/odoo/owl/releases/download/v1.0.11/owl.min.js)
|
|
||||||
|
|
||||||
## License
|
## License
|
||||||
|
|
||||||
|
|||||||
+24
-59
@@ -3,10 +3,9 @@ const readline = require("readline");
|
|||||||
const fs = require("fs");
|
const fs = require("fs");
|
||||||
const exec = require("child_process").exec;
|
const exec = require("child_process").exec;
|
||||||
const chalk = require("chalk");
|
const chalk = require("chalk");
|
||||||
const GitHub = require("github-api");
|
|
||||||
|
|
||||||
const REL_NOTES_FILE = `release-notes.md`;
|
const REL_NOTES_FILE = `release-notes.md`;
|
||||||
const STEPS = 10;
|
const STEPS = 8;
|
||||||
|
|
||||||
const rl = readline.createInterface({
|
const rl = readline.createInterface({
|
||||||
input: process.stdin,
|
input: process.stdin,
|
||||||
@@ -28,7 +27,8 @@ async function startRelease() {
|
|||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
log(`Step 1/${STEPS}: collecting info...`);
|
log(`Step 1/${STEPS}: collecting info...`);
|
||||||
const current = package.version;
|
const current = package.version;
|
||||||
const next = await ask("Next version: ");
|
let next = await ask("Next version: ");
|
||||||
|
if (next[0] === 'v') next = next.substring(1);
|
||||||
let file = await ask(`Release notes (${REL_NOTES_FILE}): `);
|
let file = await ask(`Release notes (${REL_NOTES_FILE}): `);
|
||||||
file = file || REL_NOTES_FILE;
|
file = file || REL_NOTES_FILE;
|
||||||
let content;
|
let content;
|
||||||
@@ -39,11 +39,12 @@ async function startRelease() {
|
|||||||
log("Cannot find release notes... Aborting");
|
log("Cannot find release notes... Aborting");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
let shouldBeDraft = await ask(`Should be a draft [y/n] ? (n)`);
|
||||||
// Todo: add playground update feature
|
let draft = ""
|
||||||
// let shouldUpdateStr = await ask("Update Playground? (y/n)");
|
if (shouldBeDraft.toLowerCase() === 'y')
|
||||||
// const shouldUpdatePlayground = shouldUpdateStr === "y";
|
{
|
||||||
const token = await ask("Github token: ");
|
draft = "--draft";
|
||||||
|
}
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
log(`Step 2/${STEPS}: running tests...`);
|
log(`Step 2/${STEPS}: running tests...`);
|
||||||
@@ -52,14 +53,12 @@ async function startRelease() {
|
|||||||
log("Test suite does not pass. Aborting.");
|
log("Test suite does not pass. Aborting.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
log(`Step 3/${STEPS}: updating package.json, readme.md and roadmap.md...`);
|
log(`Step 3/${STEPS}: updating package.json, readme.md and roadmap.md...`);
|
||||||
await replaceInFile("./package.json", current, next);
|
await replaceInFile("./package.json", current, next);
|
||||||
await replaceInFile("./README.md", current, next);
|
await replaceInFile("./README.md", current, next);
|
||||||
await replaceInFile("./roadmap.md", current, next);
|
await replaceInFile("./roadmap.md", current, next);
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
log(`Step 4/${STEPS}: creating git commit...`);
|
log(`Step 4/${STEPS}: creating git commit...`);
|
||||||
@@ -68,61 +67,40 @@ async function startRelease() {
|
|||||||
log("Git commit failed. Aborting.");
|
log("Git commit failed. Aborting.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// -------------------j--------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
log(`Step 5/${STEPS}: building owl (iife version)...`);
|
log(`Step 5/${STEPS}: building owl...`);
|
||||||
|
await execCommand("npm run prettier");
|
||||||
const buildResult = await execCommand("npm run build");
|
const buildResult = await execCommand("npm run build");
|
||||||
if (buildResult !== 0) {
|
if (buildResult !== 0) {
|
||||||
log("Build failed. Aborting.");
|
log("Build failed. Aborting.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
log(`Step 6/${STEPS}: minifying owl...`);
|
log(`Step 6/${STEPS}: pushing on github...`);
|
||||||
const minifyResult = await execCommand("npm run minify");
|
|
||||||
if (minifyResult !== 0) {
|
|
||||||
log("Minify failed. Aborting.");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
|
||||||
log(`Step 7/${STEPS}: pushing on github...`);
|
|
||||||
const pushResult = await execCommand("git push");
|
const pushResult = await execCommand("git push");
|
||||||
if (pushResult !== 0) {
|
if (pushResult !== 0) {
|
||||||
log("git push failed. Aborting.");
|
log("git push failed. Aborting.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
log(`Step 8/${STEPS}: publishing release notes on github...`);
|
|
||||||
const options = {
|
|
||||||
tag_name: `v${next}`,
|
|
||||||
name: `v${next}`,
|
|
||||||
body: content,
|
|
||||||
draft: true // todo: remove this someday
|
|
||||||
};
|
|
||||||
const result = await createRelease(token, options);
|
|
||||||
await ask("Ready for next step...");
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
log('Step 7/${STEPS}: Creating the release...');
|
||||||
log(`Step 9/${STEPS}: adding assets to release...`);
|
const relaseResult = await execCommand(`gh release create v${next} dist/*.js ${draft} -F release-notes.md`);
|
||||||
await ask("Please add owl.js and owl.min.js to draft release, then confirm");
|
if (relaseResult !== 0) {
|
||||||
// todo: do this with curl
|
log("github release failed. Aborting.");
|
||||||
// curl \
|
return;
|
||||||
// -H "Authorization: token $GITHUB_TOKEN" \
|
}
|
||||||
// -H "Content-Type: $(file -b --mime-type $FILE)" \
|
|
||||||
// --data-binary @$FILE \
|
|
||||||
// "https://uploads.github.com/repos/hubot/singularity/releases/123/assets?name=$(basename $FILE)"
|
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
log(`Step 8/${STEPS}: publishing module on npm...`);
|
||||||
log(`Step 10/${STEPS}: publishing module on npm...`);
|
|
||||||
await execCommand("npm run publish");
|
await execCommand("npm run publish");
|
||||||
|
|
||||||
log("Owl Release process completed! Thank you for your patience");
|
log("Owl Release process completed! Thank you for your patience");
|
||||||
|
await execCommand(`gh release view`);
|
||||||
|
await execCommand(`gh release view -w`);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// -----------------------------------------------------------------------------
|
// -----------------------------------------------------------------------------
|
||||||
@@ -199,16 +177,3 @@ async function replaceInFile(file, from, to) {
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
function createRelease(token, options) {
|
|
||||||
return new Promise((resolve, reject) => {
|
|
||||||
var gh = new GitHub({ token });
|
|
||||||
gh.getRepo("odoo", "owl").createRelease(options, (err, result, req) => {
|
|
||||||
if (err) {
|
|
||||||
reject(err);
|
|
||||||
} else {
|
|
||||||
resolve(result);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user