Reputation: 4484
I am having two repositories:
So if I create a new markdown post, I need to run a shell to build the static files and upload it to the second Github-pages repository.
I want to know is possible to do this online like:
Upvotes: 1
Views: 1528
Reputation: 59
I use this .js code:
#!/usr/bin/env node
const shell = require("shelljs");
const ghpages = require("gh-pages");
// Variables
const distDirectory = "docs/.vuepress/dist";
const commitMessage = "Site update";
// Exit if there is any error
shell.set("-e");
// Build Vuepress
shell.exec("vuepress build docs");
// Publish to GitHub Pages
ghpages.publish(distDirectory, {
message: commitMessage
}, function(err) {
if (err) {
console.log(err);
shell.exit(1);
}
});
// Message when succesfully completed
console.log("\nDocumentation has been successfully updated\n");
Keep in mind shelljs and gh-pages must be installed.
What this does:
Now to use it, run this command on Terminal:
./path/to/file.js
I'm sure this could be done with shell, but this works perfectly for me. Theorically, with only one command, you could lint JS and CSS, build Vuepress, update version, push to gh-pages, push to master and publish to npm.
Upvotes: 0