Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

Commit

Permalink
Add v2.18.2
Browse files Browse the repository at this point in the history
  • Loading branch information
YannickRe committed Mar 19, 2019
1 parent 0cea7f2 commit 4a00adf
Show file tree
Hide file tree
Showing 14 changed files with 471 additions and 215 deletions.
11 changes: 9 additions & 2 deletions Gruntfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -639,6 +639,7 @@ const configureGrunt = function (grunt) {
grunt.registerTask('release',
'Release task - creates a final built zip\n' +
' - Do our standard build steps \n' +
' - Run all tests(acceptance + regression + unit) \n' +
' - Copy files to release-folder/#/#{version} directory\n' +
' - Clean out unnecessary files (travis, .git*, etc)\n' +
' - Zip files in release-folder to dist-folder/#{version} directory',
Expand All @@ -662,8 +663,14 @@ const configureGrunt = function (grunt) {
dest: 'core/server/web/admin/views/default.html'
}]
});

grunt.task.run(['update_submodules:pinned', 'subgrunt:init', 'clean:built', 'clean:tmp', 'prod', 'clean:release', 'copy:admin_html', 'copy:release', 'compress:release']);
if (!grunt.option('skip-tests')) {
grunt.task.run(['update_submodules:pinned', 'subgrunt:init', 'test-all', 'clean:built', 'clean:tmp', 'prod', 'clean:release', 'copy:admin_html', 'copy:release', 'compress:release']);
} else {
grunt.log.writeln(chalk.red(
chalk.bold('Skipping tests...')
));
grunt.task.run(['update_submodules:pinned', 'subgrunt:init', 'clean:built', 'clean:tmp', 'prod', 'clean:release', 'copy:admin_html', 'copy:release', 'compress:release']);
}
}
);
};
Expand Down
10 changes: 10 additions & 0 deletions content/settings/routes.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
routes:

collections:
/:
permalink: /{slug}/
template: index

taxonomies:
tag: /tag/{slug}/
author: /author/{slug}/
6 changes: 6 additions & 0 deletions content/themes/casper/config.example.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"github": {
"username": "<username>",
"token": "<gh-personal-access-token>"
}
}
147 changes: 133 additions & 14 deletions content/themes/casper/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@ const {series, watch, src, dest} = require('gulp');
const pump = require('pump');

// gulp plugins and utils
var livereload = require('gulp-livereload');
var postcss = require('gulp-postcss');
var zip = require('gulp-zip');
var uglify = require('gulp-uglify');
var beeper = require('beeper');
const livereload = require('gulp-livereload');
const postcss = require('gulp-postcss');
const zip = require('gulp-zip');
const uglify = require('gulp-uglify');
const beeper = require('beeper');

// postcss plugins
var autoprefixer = require('autoprefixer');
var colorFunction = require('postcss-color-function');
var cssnano = require('cssnano');
var customProperties = require('postcss-custom-properties');
var easyimport = require('postcss-easy-import');
const autoprefixer = require('autoprefixer');
const colorFunction = require('postcss-color-function');
const cssnano = require('cssnano');
const customProperties = require('postcss-custom-properties');
const easyimport = require('postcss-easy-import');

function serve(done) {
livereload.listen();
Expand All @@ -30,7 +30,7 @@ const handleError = (done) => {
};

function css(done) {
var processors = [
const processors = [
easyimport,
customProperties({preserve: false}),
colorFunction(),
Expand All @@ -56,9 +56,9 @@ function js(done) {
}

function zipper(done) {
var targetDir = 'dist/';
var themeName = require('./package.json').name;
var filename = themeName + '.zip';
const targetDir = 'dist/';
const themeName = require('./package.json').name;
const filename = themeName + '.zip';

pump([
src([
Expand All @@ -78,3 +78,122 @@ const dev = series(build, serve, watcher);
exports.build = build;
exports.zip = series(build, zipper);
exports.default = dev;

// release imports
const path = require('path');
const releaseUtils = require('@tryghost/release-utils');

let config;
try {
config = require('./config');
} catch (err) {
config = null;
}

const REPO = 'TryGhost/Casper';
const USER_AGENT = 'Casper';
const CHANGELOG_PATH = path.join(process.cwd(), '.', 'changelog.md');

const changelog = ({previousVersion}) => {
const changelog = new releaseUtils.Changelog({
changelogPath: CHANGELOG_PATH,
folder: path.join(process.cwd(), '.')
});

changelog
.write({
githubRepoPath: `https://github.com/${REPO}`,
lastVersion: previousVersion
})
.sort()
.clean();
};

const previousRelease = () => {
return releaseUtils
.releases
.get({
userAgent: USER_AGENT,
uri: `https://api.github.com/repos/${REPO}/releases`
})
.then((response) => {
if (!response || !response.length) {
console.log('No releases found. Skipping');
return;
}

console.log(`Previous version ${response[0].name}`);
return response[0].name;
});
};

/**
*
* `yarn ship` will trigger `postship` task.
*
* [optional] For full automation
*
* `GHOST=2.10.1,2.10.0 yarn ship`
* First value: Ships with Ghost
* Second value: Compatible with Ghost/GScan
*
* You can manually run in case the task has thrown an error.
*
* `npm_package_version=0.5.0 gulp release`
*/
const release = () => {
// @NOTE: https://yarnpkg.com/lang/en/docs/cli/version/
const newVersion = process.env.npm_package_version;
let shipsWithGhost = '{version}';
let compatibleWithGhost = '2.10.0';
const ghostEnvValues = process.env.GHOST || null;

if (ghostEnvValues) {
shipsWithGhost = ghostEnvValues.split(',')[0];
compatibleWithGhost = ghostEnvValues.split(',')[1];

if (!compatibleWithGhost) {
compatibleWithGhost = '2.10.0';
}
}

if (!newVersion || newVersion === '') {
console.log('Invalid version.');
return;
}

console.log(`\nDraft release for ${newVersion}.`);

if (!config || !config.github || !config.github.username || !config.github.token) {
console.log('Please copy config.example.json and configure Github token.');
return;
}

return previousRelease()
.then((previousVersion)=> {

changelog({previousVersion});

return releaseUtils
.releases
.create({
draft: true,
preRelease: false,
tagName: newVersion,
releaseName: newVersion,
userAgent: USER_AGENT,
uri: `https://api.github.com/repos/${REPO}/releases`,
github: {
username: config.github.username,
token: config.github.token
},
content: [`**Ships with Ghost ${shipsWithGhost} Compatible with Ghost >= ${compatibleWithGhost}**\n\n`],
changelogPath: CHANGELOG_PATH
})
.then((response)=> {
console.log(`\nRelease draft generated: ${response.releaseUrl}\n`);
});
});
};

exports.release = release;
8 changes: 5 additions & 3 deletions content/themes/casper/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "casper",
"description": "The default personal blogging theme for Ghost. Beautiful, minimal and responsive.",
"demo": "https://demo.ghost.io",
"version": "2.9.5",
"version": "2.9.6",
"engines": {
"ghost": ">=2.0.0",
"ghost-api": "v2"
Expand All @@ -18,7 +18,8 @@
"test": "gscan .",
"pretest": "gulp build",
"preship": "yarn test",
"ship": "STATUS=$(git status --porcelain); echo $STATUS; if [ -z \"$STATUS\" ]; then yarn version && git push --follow-tags; fi"
"ship": "STATUS=$(git status --porcelain); echo $STATUS; if [ -z \"$STATUS\" ]; then yarn version && git push --follow-tags; else echo \"Uncomitted changes found.\" && exit 1; fi",
"postship": "git fetch && gulp release"
},
"author": {
"name": "Ghost Foundation",
Expand All @@ -44,7 +45,8 @@
"bugs": "https://github.com/TryGhost/Casper/issues",
"contributors": "https://github.com/TryGhost/Casper/graphs/contributors",
"devDependencies": {
"autoprefixer": "9.4.10",
"@tryghost/release-utils": "0.3.1",
"autoprefixer": "9.5.0",
"beeper": "1.1.1",
"cssnano": "4.1.10",
"gscan": "2.3.0",
Expand Down
Loading

0 comments on commit 4a00adf

Please sign in to comment.