Skip to content

Commit 5898b74

Browse files
Add prepare release script
Fixes issue #286
1 parent a4f836f commit 5898b74

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

build/release-prepare

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env php
2+
<?php
3+
4+
$version = $argv[1] ?? '';
5+
6+
if (empty($version)) {
7+
echo "version number is missing\n";
8+
exit(1);
9+
}
10+
11+
$root = realpath(__DIR__ . '/..') . '/';
12+
$file = $root . 'src/CH.php';
13+
$ch = file_get_contents($file);
14+
$date = date('Y-m-d');
15+
16+
$ch = preg_replace("~VERSION = '[0-9]+\.[0-9]+.[0-9]';~", "VERSION = '$version';", $ch);
17+
$ch = preg_replace("~RELEASE_DATE = '[0-9]+-[0-9]+-[0-9]+';~", "RELEASE_DATE = '$date';", $ch);
18+
19+
file_put_contents($file, $ch);
20+
21+
`git add $file`;
22+
`git commit -m'Prepare version $version'`;
23+
`git tag -asm'Version $version' $version`;
24+

0 commit comments

Comments
 (0)