-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreleaser
71 lines (54 loc) · 1.67 KB
/
releaser
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
#!/usr/bin/fish
function clean
echo $argv | cut -d= -f2- | cut -c2- | sed 's/.$//'
end
set -l p_info (cat PLUGININFO)
echo (clean $p_info[1]) | read -d. -l major minor patch dev
echo (clean $p_info[2]) | sed -E 's/(\\[|\\]|,)//g' | read -t -a p_authors
set -l p_name (clean $p_info[3])
read -P 'New version: ' -c $major.$minor.$patch -l new_version
read -P 'Auhors: ' -c "$p_authors" -l new_authors
set -l new_authors "['"(echo $new_authors | string split , | string trim | string join "', '")"']"
function gen
echo 'Version="{v}"
Authors={a}
Name="{n}"
Description="{d}"'| \
string replace '{v}' $argv[1] | \
string replace '{a}' $argv[2] | \
string replace '{n}' $argv[3] | \
string replace '{d}' $argv[4] > PLUGININFO
printf '%s\n' $argv[5..-1] >> PLUGININFO
end
set -l new_description (cat DESCRIPTION | string join \\n | sed 's/"/\\\\"/g')
gen $new_version $new_authors $p_name $new_description $p_info[5..-1]
git add PLUGININFO
git diff --staged
function revert
git reset PLUGININFO
git checkout PLUGININFO
end
if test (read -P 'Oki [Y/n]? ' -c Y) != 'Y'
echo 'Not oki :/'
revert
exit 1
end
git commit -S -m "Release $new_version"
git tag "v$new_version"
echo $new_version | read -d. -l major minor patch
set -l dev_version $major.$minor.(math $patch + 1).dev0
gen $dev_version $new_authors $p_name $new_description $p_info[5..-1]
echo "Back to development $dev_version"
git add PLUGININFO
git diff --staged
if test (read -P 'Oki [Y/n]? ' -c Y) != 'Y'
echo 'Not oki :/'
exit
end
git commit -S -m "Back to development $dev_version"
if test (read -P 'Push [Y/n]? ' -c Y) != 'Y'
echo 'Not oki :/'
exit
end
git push
git push --tag