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

Commit

Permalink
feat(grunt): automate releases
Browse files Browse the repository at this point in the history
  • Loading branch information
hypeJunction committed Jul 14, 2016
1 parent 7a9a32b commit 8a8cc17
Show file tree
Hide file tree
Showing 6 changed files with 202 additions and 2 deletions.
9 changes: 7 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
#Ignore files that will need to be changed locally
.DS_Store
.htaccess
robots.txt
/nbproject/
/.sass-cache/
/node_modules/
/build/
/releases/
/vendor/
composer.lock
/mod/
composer.lock
Gemfile.lock
Empty file added CHANGELOG.md
Empty file.
159 changes: 159 additions & 0 deletions Gruntfile.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,159 @@
module.exports = function (grunt) {

var package = grunt.file.readJSON('package.json');

// Project configuration.
grunt.initConfig({
pkg: package,
// Bump version numbers
version: {
pkg: {
src: ['package.json', 'composer.json'],
},
manifest: {
options: {
pkg: grunt.file.readJSON('package.json'),
prefix: '\<version type=\"dist\"\>'
},
src: ['manifest.xml'],
}
},
clean: {
release: {
src: ['build/', 'releases/', 'mod/', 'vendor/', 'composer.lock']
}
},
copy: {
release: {
src: [
'**',
'!**/.git*',
'!releases/**',
'!build/**',
'!mod/**',
'!node_modules/**',
'!package.json',
'!config.rb',
'!sass/**',
'!tests/**',
'!composer.json',
'!composer.lock',
'!package.json',
'!phpunit.xml',
'!Gruntfile.js',
'!Gemfile',
'!Gemfile.lock'
],
dest: 'build/',
expand: true
},
},
compress: {
release: {
options: {
archive: 'releases/<%= pkg.name %>-<%= pkg.version %>.zip'
},
cwd: 'build/',
src: ['**/*'],
dest: '<%= pkg.name %>/',
expand: true
}
},
gitcommit: {
release: {
options: {
message: 'chore(build): release <%= pkg.version %>',
},
files: {
src: ["composer.json", "manifest.xml", "package.json", "CHANGELOG.md"],
}
},
},
gitfetch: {
release: {
all: true
}
},
gittag: {
release: {
options: {
tag: '<%= pkg.version %>',
message: 'Release <%= pkg.version %>'
}
}
},
gitpush: {
release: {
},
release_tags: {
options: {
tags: true
}
}
},
gh_release: {
options: {
token: process.env.GITHUB_TOKEN,
repo: package.repository.repo,
owner: package.repository.owner
},
release: {
tag_name: '<%= pkg.version %>',
name: 'Release <%= pkg.version %>',
body: grunt.file.read('release.md'),
draft: false,
prerelease: false,
asset: {
name: '<%= pkg.name %>-<%= pkg.version %>.zip',
file: 'releases/<%= pkg.name %>-<%= pkg.version %>.zip',
'Content-Type': 'application/zip'
}
}
},
conventionalChangelog: {
options: {
changelogOpts: {
// conventional-changelog options go here
preset: 'angular'
}
},
release: {
src: 'CHANGELOG.md'
}

}
});
// Load all grunt plugins here
grunt.loadNpmTasks('grunt-version');
grunt.loadNpmTasks('grunt-contrib-copy');
grunt.loadNpmTasks('grunt-contrib-clean');
grunt.loadNpmTasks('grunt-contrib-compress');
grunt.loadNpmTasks('grunt-composer');
grunt.loadNpmTasks('grunt-conventional-changelog');
grunt.loadNpmTasks('grunt-git');
grunt.loadNpmTasks('grunt-gh-release');

grunt.registerTask('readpkg', 'Read in the package.json file', function () {
grunt.config.set('pkg', grunt.file.readJSON('package.json'));
});

// Release task
grunt.registerTask('release', function (n) {
var n = n || 'patch';
grunt.task.run([
'version::' + n,
'readpkg',
'conventionalChangelog:release',
'gitfetch:release',
'gitcommit:release',
'gittag:release',
'gitpush:release',
'gitpush:release_tags',
'clean:release',
'composer:install:no-dev:prefer-dist',
'copy:release',
'compress:release',
'gh_release',
]);
});
};
7 changes: 7 additions & 0 deletions autoloader.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
<?php

$path = __DIR__;
if (file_exists("{$path}/vendor/autoload.php")) {
require_once "{$path}/vendor/autoload.php";
}

24 changes: 24 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"name": "ambercal_settings_transfer",
"version": "1.1.0",
"license": "GPL-2.0",
"repository": {
"type": "git",
"url": "git@github.com:hypeJunction/Elgg-transfer_plugin_settings.git",
"owner": "hypeJunction",
"repo": "Elgg-transfer_plugin_settings"
},
"devDependencies": {
"curlrequest": "^0.3.10",
"grunt": "^0.4.5",
"grunt-composer": "^0.4.4",
"grunt-contrib-clean": "^0.6.0",
"grunt-contrib-compress": "^0.13.0",
"grunt-contrib-copy": "^0.8.0",
"grunt-conventional-changelog": "^5.0.0",
"grunt-gh-release": "0.0.2",
"grunt-git": "^0.3.5",
"grunt-version": "^1.0.0",
"underscore": "^1.8.3"
}
}
5 changes: 5 additions & 0 deletions release.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
![Elgg 1.9](https://img.shields.io/badge/Elgg-1.9.x-orange.svg?style=flat-square)
![Elgg 1.10](https://img.shields.io/badge/Elgg-1.10.x-orange.svg?style=flat-square)
![Elgg 1.11](https://img.shields.io/badge/Elgg-1.11.x-orange.svg?style=flat-square)
![Elgg 1.12](https://img.shields.io/badge/Elgg-1.12.x-orange.svg?style=flat-square)
![Elgg 2.0](https://img.shields.io/badge/Elgg-2.0.x-orange.svg?style=flat-square)

0 comments on commit 8a8cc17

Please sign in to comment.