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

Commit 8a8cc17

Browse files
committed
feat(grunt): automate releases
1 parent 7a9a32b commit 8a8cc17

File tree

6 files changed

+202
-2
lines changed

6 files changed

+202
-2
lines changed

.gitignore

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,12 @@
11
#Ignore files that will need to be changed locally
22
.DS_Store
3-
.htaccess
43
robots.txt
54
/nbproject/
5+
/.sass-cache/
6+
/node_modules/
7+
/build/
8+
/releases/
69
/vendor/
7-
composer.lock
10+
/mod/
11+
composer.lock
12+
Gemfile.lock

CHANGELOG.md

Whitespace-only changes.

Gruntfile.js

+159
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,159 @@
1+
module.exports = function (grunt) {
2+
3+
var package = grunt.file.readJSON('package.json');
4+
5+
// Project configuration.
6+
grunt.initConfig({
7+
pkg: package,
8+
// Bump version numbers
9+
version: {
10+
pkg: {
11+
src: ['package.json', 'composer.json'],
12+
},
13+
manifest: {
14+
options: {
15+
pkg: grunt.file.readJSON('package.json'),
16+
prefix: '\<version type=\"dist\"\>'
17+
},
18+
src: ['manifest.xml'],
19+
}
20+
},
21+
clean: {
22+
release: {
23+
src: ['build/', 'releases/', 'mod/', 'vendor/', 'composer.lock']
24+
}
25+
},
26+
copy: {
27+
release: {
28+
src: [
29+
'**',
30+
'!**/.git*',
31+
'!releases/**',
32+
'!build/**',
33+
'!mod/**',
34+
'!node_modules/**',
35+
'!package.json',
36+
'!config.rb',
37+
'!sass/**',
38+
'!tests/**',
39+
'!composer.json',
40+
'!composer.lock',
41+
'!package.json',
42+
'!phpunit.xml',
43+
'!Gruntfile.js',
44+
'!Gemfile',
45+
'!Gemfile.lock'
46+
],
47+
dest: 'build/',
48+
expand: true
49+
},
50+
},
51+
compress: {
52+
release: {
53+
options: {
54+
archive: 'releases/<%= pkg.name %>-<%= pkg.version %>.zip'
55+
},
56+
cwd: 'build/',
57+
src: ['**/*'],
58+
dest: '<%= pkg.name %>/',
59+
expand: true
60+
}
61+
},
62+
gitcommit: {
63+
release: {
64+
options: {
65+
message: 'chore(build): release <%= pkg.version %>',
66+
},
67+
files: {
68+
src: ["composer.json", "manifest.xml", "package.json", "CHANGELOG.md"],
69+
}
70+
},
71+
},
72+
gitfetch: {
73+
release: {
74+
all: true
75+
}
76+
},
77+
gittag: {
78+
release: {
79+
options: {
80+
tag: '<%= pkg.version %>',
81+
message: 'Release <%= pkg.version %>'
82+
}
83+
}
84+
},
85+
gitpush: {
86+
release: {
87+
},
88+
release_tags: {
89+
options: {
90+
tags: true
91+
}
92+
}
93+
},
94+
gh_release: {
95+
options: {
96+
token: process.env.GITHUB_TOKEN,
97+
repo: package.repository.repo,
98+
owner: package.repository.owner
99+
},
100+
release: {
101+
tag_name: '<%= pkg.version %>',
102+
name: 'Release <%= pkg.version %>',
103+
body: grunt.file.read('release.md'),
104+
draft: false,
105+
prerelease: false,
106+
asset: {
107+
name: '<%= pkg.name %>-<%= pkg.version %>.zip',
108+
file: 'releases/<%= pkg.name %>-<%= pkg.version %>.zip',
109+
'Content-Type': 'application/zip'
110+
}
111+
}
112+
},
113+
conventionalChangelog: {
114+
options: {
115+
changelogOpts: {
116+
// conventional-changelog options go here
117+
preset: 'angular'
118+
}
119+
},
120+
release: {
121+
src: 'CHANGELOG.md'
122+
}
123+
124+
}
125+
});
126+
// Load all grunt plugins here
127+
grunt.loadNpmTasks('grunt-version');
128+
grunt.loadNpmTasks('grunt-contrib-copy');
129+
grunt.loadNpmTasks('grunt-contrib-clean');
130+
grunt.loadNpmTasks('grunt-contrib-compress');
131+
grunt.loadNpmTasks('grunt-composer');
132+
grunt.loadNpmTasks('grunt-conventional-changelog');
133+
grunt.loadNpmTasks('grunt-git');
134+
grunt.loadNpmTasks('grunt-gh-release');
135+
136+
grunt.registerTask('readpkg', 'Read in the package.json file', function () {
137+
grunt.config.set('pkg', grunt.file.readJSON('package.json'));
138+
});
139+
140+
// Release task
141+
grunt.registerTask('release', function (n) {
142+
var n = n || 'patch';
143+
grunt.task.run([
144+
'version::' + n,
145+
'readpkg',
146+
'conventionalChangelog:release',
147+
'gitfetch:release',
148+
'gitcommit:release',
149+
'gittag:release',
150+
'gitpush:release',
151+
'gitpush:release_tags',
152+
'clean:release',
153+
'composer:install:no-dev:prefer-dist',
154+
'copy:release',
155+
'compress:release',
156+
'gh_release',
157+
]);
158+
});
159+
};

autoloader.php

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<?php
2+
3+
$path = __DIR__;
4+
if (file_exists("{$path}/vendor/autoload.php")) {
5+
require_once "{$path}/vendor/autoload.php";
6+
}
7+

package.json

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
{
2+
"name": "ambercal_settings_transfer",
3+
"version": "1.1.0",
4+
"license": "GPL-2.0",
5+
"repository": {
6+
"type": "git",
7+
"url": "[email protected]:hypeJunction/Elgg-transfer_plugin_settings.git",
8+
"owner": "hypeJunction",
9+
"repo": "Elgg-transfer_plugin_settings"
10+
},
11+
"devDependencies": {
12+
"curlrequest": "^0.3.10",
13+
"grunt": "^0.4.5",
14+
"grunt-composer": "^0.4.4",
15+
"grunt-contrib-clean": "^0.6.0",
16+
"grunt-contrib-compress": "^0.13.0",
17+
"grunt-contrib-copy": "^0.8.0",
18+
"grunt-conventional-changelog": "^5.0.0",
19+
"grunt-gh-release": "0.0.2",
20+
"grunt-git": "^0.3.5",
21+
"grunt-version": "^1.0.0",
22+
"underscore": "^1.8.3"
23+
}
24+
}

release.md

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
![Elgg 1.9](https://img.shields.io/badge/Elgg-1.9.x-orange.svg?style=flat-square)
2+
![Elgg 1.10](https://img.shields.io/badge/Elgg-1.10.x-orange.svg?style=flat-square)
3+
![Elgg 1.11](https://img.shields.io/badge/Elgg-1.11.x-orange.svg?style=flat-square)
4+
![Elgg 1.12](https://img.shields.io/badge/Elgg-1.12.x-orange.svg?style=flat-square)
5+
![Elgg 2.0](https://img.shields.io/badge/Elgg-2.0.x-orange.svg?style=flat-square)

0 commit comments

Comments
 (0)