-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathGruntfile.js
More file actions
107 lines (102 loc) · 3.19 KB
/
Gruntfile.js
File metadata and controls
107 lines (102 loc) · 3.19 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
module.exports = function(grunt) {
grunt.initConfig({
pkg: grunt.file.readJSON('package.json'),
home: process.env.HOME,
version: "v0.3",
appdmg: {
options: {
"title": "Magic Presenter",
"icon": "installer-mp-mounted.icns",
"background": "installer-mp-background.png",
"icon-size": 100,
"window": {
"size": { "width": 500, "height": 320 }
},
"contents": [
{ "x": 375, "y": 115, "type": "file", "path": "MagicPresenter.sketchplugin" }
]
},
target: {
dest: 'MagicPresenter.dmg'
}
},
shell: {
kill: {
command: [
'pkill Sketch || true',
].join(' && ')
},
test: {
command: [
'./coscript RunTests.js'
].join(' && ')
},
install: {
command: [
'rm -rf "<%= home %>/Library/Application Support/com.bohemiancoding.sketch3/Plugins/MagicPresenter.sketchplugin"',
'cp -r MagicPresenter.sketchplugin "<%= home %>/Library/Application Support/com.bohemiancoding.sketch3/Plugins/"'
].join(' && ')
},
build: {
command: [
'mkdir -p Logs',
'echo "Building Release Version of MagicPresenter"',
'xctool -scheme MagicPresenter -configuration Release',
].join(' && ')
},
beforeappdmg: {
command: [
'rm -rf MagicPresenter.dmg',
].join(' && ')
},
commit: {
command: [
'git add .',
'git commit -m "Update binary"'
].join(' && ')
},
tag: {
command: [
'git tag -a <%= version %> -m "<%= version %>"',
'git push origin <%= version %>',
].join(' && ')
},
},
gh_release: {
options: {
// Credentials, required
token: process.env.GITHUB_TOKEN,
owner: 'MagicSketch',
repo: 'MagicPresenter'
},
release: {
// Release input
// All options are optional, details: http://developer.github.com/v3/repos/releases/#input-1
tag_name: '<%= version %>',
// target_commitish: 'master',
name: '<%= version %>',
body: 'Description of the release.',
draft: false,
prerelease: true,
asset: {
// Upload a release asset if needed
name: 'MagicPresenter.dmg',
file: 'MagicPresenter.dmg',
'Content-Type': 'application/x-apple-diskimage' // Common media types: http://en.wikipedia.org/wiki/Internet_media_type#List_of_common_media_types
}
}
},
});
grunt.loadNpmTasks('grunt-shell');
grunt.loadNpmTasks('grunt-gh-release');
grunt.loadNpmTasks('grunt-appdmg');
grunt.registerTask('kill', ['shell:kill']);
grunt.registerTask('test', ['shell:test']);
grunt.registerTask('install', ['shell:install']);
grunt.registerTask('build', ['shell:build']);
grunt.registerTask('archive', ['shell:beforeappdmg', 'appdmg']);
grunt.registerTask('default', ['build', 'install', 'archive']);
grunt.registerTask('tag', ['shell:tag']);
grunt.registerTask('upload', ['tag', 'gh_release']);
grunt.registerTask('release', ['build', 'archive', 'shell:commit', 'upload']);
};