Skip to content

Instantly share code, notes, and snippets.

@ilyazub
Forked from ErisDS/README.md
Last active December 23, 2021 16:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyazub/e2caf1b68b55460fe12e5d069d7711f8 to your computer and use it in GitHub Desktop.
Save ilyazub/e2caf1b68b55460fe12e5d069d7711f8 to your computer and use it in GitHub Desktop.
Deployment tools for Ghost themes

Gulp tools to deploy a Ghost theme

Using @tryghost/admin-api.

Set up

Usage

$ gulp deploy
[17:47:17] Using gulpfile ~/Git/serpapi-theme/gulpfile.js
[17:47:17] Starting 'deploy'...
[17:47:17] Starting 'css'...
[17:47:19] Finished 'css' after 2.14 s
[17:47:19] Starting 'js'...
[17:47:19] Finished 'js' after 169 ms
[17:47:19] Starting 'zipper'...
[17:47:20] Finished 'zipper' after 335 ms
[17:47:20] Starting 'uploader'...
[17:47:21] Finished 'uploader' after 960 ms
[17:47:21] Finished 'deploy' after 3.61 s
const GhostAdminAPI = require('@tryghost/admin-api');
function uploader(done) {
const filename = require('./package.json').name + '.zip';
const api = new GhostAdminAPI({
// Replace URL with your own
url: 'http://localhost:2368',
version: "v3",
// Obtain API key by creating a new integration at http://localhost:2368/ghost/#/settings/integrations
key: '86858839df28e6ffaec6b765:f819fbb7b9985fa6ac58086bb50d7ca2aea8a0f09201b40ecb7973457e03b87d'
});
let data = { file: `./dist/${filename}` }
return api.themes.upload(data)
.catch(done);
}
const build = series(css, js);
exports.deploy = series(build, zipper, uploader);
function css(done) {
// Omitted because it's in a regular Casper theme
}
function js(done) {
// Omitted because it's in a regular Casper theme
}
function zipper(done) {
// Omitted because it's in a regular Casper theme
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment