Update gh pages task (#3762)

* Add task for updating github pages from develop
This commit is contained in:
alschmiedt
2020-03-23 16:49:03 -07:00
committed by GitHub
parent c7620bc3fc
commit 40d39fd0c5
3 changed files with 22 additions and 2 deletions

View File

@@ -56,6 +56,7 @@ module.exports = {
gitSyncMaster: gitTasks.syncMaster,
gitCreateRC: gitTasks.createRC,
gitRecompile: gitTasks.recompile,
gitUpdateGithubPages: gitTasks.updateGithubPages,
typings: typings.typings,
package: packageTasks.package,
checkLicenses: licenseTasks.checkLicenses

View File

@@ -41,6 +41,7 @@
"test:setupselenium": "selenium-standalone install --config=./tests/scripts/selenium-config.js",
"test:startselenium": "selenium-standalone start --config=./tests/scripts/selenium-config.js",
"typings": "gulp typings",
"updateGithubPages": "gulp gitUpdateGithubPages",
"version": "gulp build && git add -A"
},
"main": "./index.js",

View File

@@ -21,7 +21,7 @@ const upstream_url = "https://github.com/google/blockly.git";
function syncBranch(branchName) {
return function(done) {
execSync('git stash save -m "Stash for sync"', { stdio: 'inherit' });
execSync('git checkout ' + branchName, { stdio: 'inherit' });
checkoutBranch(branchName);
execSync('git pull ' + upstream_url + ' ' + branchName,
{ stdio: 'inherit' });
execSync('git push origin ' + branchName, { stdio: 'inherit' });
@@ -56,6 +56,13 @@ function getRCBranchName() {
return 'rc_' + yyyy + '_' + mm;
};
// If branch does not exist then create the branch.
// If branch exists switch to branch.
function checkoutBranch(branchName) {
execSync('git checkout ' + branchName + ' || git checkout -b ' + branchName,
{ stdio: 'inherit' });
}
// Recompile and push to origin.
const recompile = gulp.series(
syncDevelop,
@@ -93,9 +100,20 @@ const createRC = gulp.series(
},
);
// Update github pages with what is currently in develop.
const updateGithubPages = gulp.series(
syncBranch('gh-pages'),
function(done) {
execSync('git pull ' + upstream_url + ' develop', { stdio: 'inherit' });
execSync('git push ' + upstream_url + ' gh-pages', { stdio: 'inherit' });
done();
}
);
module.exports = {
syncDevelop: syncDevelop,
syncMaster: syncMaster,
createRC: createRC,
recompile: recompile
recompile: recompile,
updateGithubPages: updateGithubPages
}