-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathindex.js
More file actions
36 lines (31 loc) · 1.48 KB
/
index.js
File metadata and controls
36 lines (31 loc) · 1.48 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
const exec = require('child_process').exec;
const version = process.argv[2];
const build = process.argv[3];
const filePath = `releases/Glip-Plus-${version}.dmg`;
// generate dmg
exec(`appdmg appdmg/appdmg.json ${filePath}`, function (error, stdout, stderr) {
// get file size
const fs = require('fs');
const fileSize = fs.statSync(filePath)['size'];
// get date string
const moment = require('moment');
const dateStr = moment().format('ddd, DD MMM Y HH:mm:ss +0000');
// get dsa signature
exec(`appdmg/sign_update ${filePath} appdmg/dsa_priv.pem`, function (error, stdout, stderr) {
const dsaSignature = stdout.trim();
console.log(`
<item>
<title>Version ${version} (2 breaking changes, 2 new features, 2 bug fixes)</title>
<sparkle:releaseNotesLink>
https://raw.githubusercontent.com/tylerlong/glip-plus-dist/gh-pages/releases/${version}.md
</sparkle:releaseNotesLink>
<pubDate>${dateStr}</pubDate>
<enclosure url="https://tylerlong.github.io/glip-plus-dist/releases/Glip-Plus-${version}.dmg" sparkle:version="${build}" sparkle:shortVersionString="${version}" length="${fileSize}"
type="application/octet-stream" sparkle:dsaSignature="${dsaSignature}" />
<sparkle:minimumSystemVersion>10.10</sparkle:minimumSystemVersion>
</item>
`);
});
// create release notes markdown file
fs.writeFile(`releases/${version}.md`, `# Glip Plus ${version}`, function (error) { });
});