forked from mtex-toolbox/mtex
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makeRelease.m
49 lines (35 loc) · 1.26 KB
/
makeRelease.m
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
function makeRelease
ver = strrep(lower(getMTEXpref('version')),' ','-');
rDir = fullfile(mtex_path,'..','releases',ver);
zipName = [rDir,'.zip'];
if ~strcmpi(input(['Do you really want to release ' ver '? Y/N [N]:'],'s'),'Y')
return;
end
unix(['rm -rf ',rDir]);
unix(['cp -R ' mtex_path ' ' rDir]);
rmList = {'doc/makeDoc/tmp', 'myToken.txt', 'data/*.mat' '.git*' 'data/EBSD/*'};
for rd = rmList
unix(['rm -rf ' rDir filesep char(rd)]);
end
if any(strfind(ver,'beta'))
unix(['rm -rf ' rDir filesep 'doc/html/*']);
mkdir([rDir filesep 'doc/html/helpsearch-v3/']);
end
unix(['chmod -R a+rX ' rDir]);
% delete backup files
unix(['find ' rDir ' -name ''*~'' -or -name ''*.log'' -or -name ''*.o'' '...
'-or -name ''*.orig'' -or -name ''.directory'' | xargs /bin/rm -rf']);
% delete old zip
unix(['rm -rf ' rDir '.zip']);
% create new zip
disp('compressing release ...')
zip(zipName,rDir);
disp('Authenticate at Github ...')
unix(['terminator -e "gh auth login"']);
% gh auth login
%doRelease = ['gh release create ' ver ' ' zipName ' -t "' getMTEXpref('version') '"'];
doRelease = ['gh release create ' ver ' ' zipName];
if any(strfind(ver,'beta')), doRelease = [doRelease,' -p']; end
disp('uploading release to GitHub ...')
unix(['terminator -e "' doRelease '"']);
end