-
Notifications
You must be signed in to change notification settings - Fork 1
/
publish.bat
137 lines (125 loc) · 4.01 KB
/
publish.bat
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
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
@echo off
git pull
REM 定义函数 改变版本
for /f "tokens=1-3 delims==. " %%a in ('type version.sh') do (
if %%a == MAJOR (
set /a MAJOR=%%b
)else if %%a == MONOR (
set /a MONOR=%%b
)else if %%a == BUILD (
set /a BUILD=%%b
)
)
echo MAJOR=%MAJOR%
echo MONOR=%MONOR%
echo BUILD=%BUILD%
set /a OLDBUILD = BUILD + 0
echo %OLDBUILD%
set OLDBUILD1 = BUILD
echo %OLDBUILD1%
set /a BUILD+=1
REM 将更新后的变量值写回文件
echo MAJOR=%MAJOR% > version.sh
echo MONOR=%MONOR% >> version.sh
echo BUILD=%BUILD% >> version.sh
REM 修改oauth下的 build.gradle.kts
cd oauth-gw
set search=version = "%MAJOR%.%MONOR%.%OLDBUILD%"
set replace=version = "%MAJOR%.%MONOR%.%BUILD%"
for /f "tokens=* delims=" %%a in ('type build.gradle.kts') do (
if "%%a" == "%search%" (
echo %replace% >> build.gradle.kts1
) else (
echo %%a >> build.gradle.kts1
)
)
del build.gradle.kts
rename build.gradle.kts1 build.gradle.kts
cd ..
REM 修改pm-web-app下的package.json
cd pm-web-app
set search= "version": "%MAJOR%.%MONOR%.%OLDBUILD%",
set replace= "version": "%MAJOR%.%MONOR%.%BUILD%",
for /f "tokens=* delims=" %%a in ('type package.json') do (
if "%%a" == "%search%" (
echo %replace% >> temp.json
)
if not "%%a" == "%search%" (
echo %%a >> temp.json
)
)
del package.json
rename temp.json package.json
cd ..
REM 修改pm-web-mobile下的package.json和.env
cd pm-web-mobile
set search= "version": "%MAJOR%.%MONOR%.%OLDBUILD%",
set replace= "version": "%MAJOR%.%MONOR%.%BUILD%",
for /f "tokens=* delims=" %%a in ('type package.json') do (
if "%%a" == "%search%" (
echo %replace% >> temp.json
)
if not "%%a" == "%search%" (
echo %%a >> temp.json
)
)
del package.json
rename temp.json package.json
set envValue =VUE_APP_VERSION = "%MAJOR%.%MONOR%.%BUILD%"
set replace=VUE_APP_VERSION = "%MAJOR%.%MONOR%.%BUILD%"
set vav=VUE_APP_VERSION = "%MAJOR%.%MONOR%.%BUILD%"
echo %replace% > .env
cd ..
REM 修改pm-resource-server下的package.json
cd pm-web-app
set search= "version": "%MAJOR%.%MONOR%.%OLDBUILD%",
set replace= "version": "%MAJOR%.%MONOR%.%BUILD%",
for /f "tokens=* delims=" %%a in ('type package.json') do (
if "%%a" == "%search%" (
echo %replace% >> temp.json
)
if not "%%a" == "%search%" (
echo %%a >> temp.json
)
)
del package.json
rename temp.json package.json
cd ..
REM 修改helm/pm下的package.json
cd helm/pm
set search=version: "%MAJOR%.%MONOR%.%OLDBUILD%"
set replace=version: "%MAJOR%.%MONOR%.%BUILD%"
for /f "tokens=* delims=" %%a in ('type Chart.yaml') do (
if "%%a" == "%search%" (
echo %replace% >> temp.yaml
)
if not "%%a" == "%search%" (
echo %%a >> temp.yaml
)
)
del Chart.yaml
rename temp.yaml Chart.yaml
set search=version: "%MAJOR%.%MONOR%.%OLDBUILD%"
set replace=version: "%MAJOR%.%MONOR%.%BUILD%"
for /f "tokens=* delims=" %%a in ('type values.yaml') do (
if "%%a" == "%search%" (
echo %replace% >> temp.yaml
)
if not "%%a" == "%search%" (
echo %%a >> temp.yaml
)
)
del values.yaml
rename temp.yaml values.yaml
cd ../..
echo git add .
echo git commit -m 'release '%MAJOR%.%MONOR%.%BUILD%
echo git tag -a %MAJOR%.%MONOR%.%BUILD% -m 'release '%MAJOR%.%MONOR%.%BUILD%
echo git push
echo git push origin %MAJOR%.%MONOR%.%BUILD%
REM git add .
REM git add .
REM git commit -m 'release '%MAJOR%.%MONOR%.%BUILD%
REM git tag -a %MAJOR%.%MONOR%.%BUILD% -m 'release '%MAJOR%.%MONOR%.%BUILD%
REM git push
REM git push origin %MAJOR%.%MONOR%.%BUILD%