-
Notifications
You must be signed in to change notification settings - Fork 18
/
release.js
29 lines (21 loc) · 839 Bytes
/
release.js
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
const replace = require('replace-in-file');
const fs = require('fs');
const {execSync} = require('child_process');
execSync('npm version patch --commit-hooks false --git-tag-version false');
const pkg = JSON.parse(fs.readFileSync('./package.json'));
replace.sync({
files: './composer.json',
from: /("version": ")([^"]+)/ig,
to: '$1' + pkg.version
});
replace.sync({
files: './composer.json',
from: /"https:\/\/github.com\/iamntz\/carbon-fields-urlpicker\/releases\/download\/v[^/]+\/carbon-fields-urlpicker.zip"/ig,
to: `"https://github.com/iamntz/carbon-fields-urlpicker/releases/download/v${pkg.version}/carbon-fields-urlpicker.zip"`
})
const hash = execSync('git rev-parse HEAD').toString().trim();
replace.sync({
files: './composer.json',
from: /("reference": ")[^"]+/ig,
to: `$1${hash}`
})