@soft-artel/ci 1.3.15 → 1.3.16
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/k8s/App.d.ts +22 -0
- package/k8s/App.d.ts.map +1 -0
- package/k8s/App.js +150 -0
- package/k8s/App.js.map +1 -0
- package/k8s/DockerImage.d.ts +15 -0
- package/k8s/DockerImage.d.ts.map +1 -0
- package/k8s/DockerImage.js +112 -0
- package/k8s/DockerImage.js.map +1 -0
- package/k8s/Node.d.ts +17 -0
- package/k8s/Node.d.ts.map +1 -0
- package/k8s/Node.js +103 -0
- package/k8s/Node.js.map +1 -0
- package/k8s-build.d.ts +3 -0
- package/k8s-build.d.ts.map +1 -0
- package/k8s-build.js +125 -0
- package/k8s-build.js.map +1 -0
- package/k8s-deploy.d.ts +3 -0
- package/k8s-deploy.d.ts.map +1 -0
- package/k8s-deploy.js +124 -0
- package/k8s-deploy.js.map +1 -0
- package/libs/Exception.d.ts +5 -0
- package/libs/Exception.d.ts.map +1 -0
- package/libs/Exception.js +13 -0
- package/libs/Exception.js.map +1 -0
- package/libs/Git.d.ts +44 -0
- package/libs/Git.d.ts.map +1 -0
- package/libs/Git.js +160 -0
- package/libs/Git.js.map +1 -0
- package/libs/Gitlab.d.ts +12 -0
- package/libs/Gitlab.d.ts.map +1 -0
- package/libs/Gitlab.js +78 -0
- package/libs/Gitlab.js.map +1 -0
- package/libs/Jira.d.ts +31 -0
- package/libs/Jira.d.ts.map +1 -0
- package/libs/Jira.js +157 -0
- package/libs/Jira.js.map +1 -0
- package/libs/Project.d.ts +39 -0
- package/libs/Project.d.ts.map +1 -0
- package/libs/Project.js +177 -0
- package/libs/Project.js.map +1 -0
- package/libs/Reporter.d.ts +34 -0
- package/libs/Reporter.d.ts.map +1 -0
- package/libs/Reporter.js +131 -0
- package/libs/Reporter.js.map +1 -0
- package/libs/Shell.d.ts +39 -0
- package/libs/Shell.d.ts.map +1 -0
- package/libs/Shell.js +107 -0
- package/libs/Shell.js.map +1 -0
- package/libs/helpers.d.ts +29 -0
- package/libs/helpers.d.ts.map +1 -0
- package/libs/helpers.js +101 -0
- package/libs/helpers.js.map +1 -0
- package/libs/prototype.d.ts +9 -0
- package/libs/prototype.d.ts.map +1 -0
- package/libs/prototype.js +186 -0
- package/libs/prototype.js.map +1 -0
- package/package.json +1 -1
- package/upd_pkg.d.ts +3 -0
- package/upd_pkg.d.ts.map +1 -0
- package/upd_pkg.js +28 -0
- package/upd_pkg.js.map +1 -0
- package/xcode.d.ts +3 -0
- package/xcode.d.ts.map +1 -0
- package/xcode.js +163 -0
- package/xcode.js.map +1 -0
- package/.env +0 -21
- package/.eslintcache +0 -1
- package/.eslintignore +0 -4
- package/.eslintrc +0 -246
- package/.gitlab-ci.yml +0 -12
- package/_publish.sh +0 -24
- package/k8s/App.ts +0 -200
- package/k8s/DockerImage.ts +0 -147
- package/k8s/Node.ts +0 -119
- package/k8s-build.ts +0 -175
- package/k8s-deploy.ts +0 -174
- package/libs/Exception.ts +0 -19
- package/libs/Git.ts +0 -199
- package/libs/Gitlab.ts +0 -86
- package/libs/Jira.ts +0 -239
- package/libs/Project.ts +0 -215
- package/libs/Reporter.ts +0 -181
- package/libs/Shell.ts +0 -119
- package/libs/helpers.ts +0 -114
- package/libs/prototype.ts +0 -313
- package/tsconfig.json +0 -24
- package/upd_pkg.ts +0 -21
- package/xcode.ts +0 -226
package/libs/prototype.ts
DELETED
|
@@ -1,313 +0,0 @@
|
|
|
1
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
// ===========================================
|
|
5
|
-
// String
|
|
6
|
-
|
|
7
|
-
export interface String {
|
|
8
|
-
replaceAll(search: string, replacement: string): string;
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
Object.defineProperties(String.prototype, {
|
|
12
|
-
|
|
13
|
-
replaceAll: {
|
|
14
|
-
value(search: string, replacement: string): any {
|
|
15
|
-
const escapedSearch = search.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
16
|
-
return this.replace(new RegExp(escapedSearch, 'g'), replacement);
|
|
17
|
-
},
|
|
18
|
-
enumerable : false,
|
|
19
|
-
writable : true,
|
|
20
|
-
},
|
|
21
|
-
|
|
22
|
-
}
|
|
23
|
-
);
|
|
24
|
-
|
|
25
|
-
// ===========================================
|
|
26
|
-
// Array
|
|
27
|
-
|
|
28
|
-
export interface Array<T> {
|
|
29
|
-
randomElement: T;
|
|
30
|
-
delete(elm: T): T[];
|
|
31
|
-
match(str: string): boolean;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
Object.defineProperties(Array.prototype, {
|
|
35
|
-
|
|
36
|
-
randomElement: {
|
|
37
|
-
value(): any {
|
|
38
|
-
return this[ Math.round(Math.random() * (this.length - 1)) ];
|
|
39
|
-
},
|
|
40
|
-
enumerable : false,
|
|
41
|
-
writable : true,
|
|
42
|
-
},
|
|
43
|
-
|
|
44
|
-
// ----------------------------
|
|
45
|
-
|
|
46
|
-
delete: {
|
|
47
|
-
value(elm: any): any {
|
|
48
|
-
const index = this.indexOf(elm);
|
|
49
|
-
if(index === -1){
|
|
50
|
-
return this;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
this.splice(index, 1);
|
|
54
|
-
|
|
55
|
-
return this;
|
|
56
|
-
},
|
|
57
|
-
enumerable : false,
|
|
58
|
-
writable : true,
|
|
59
|
-
},
|
|
60
|
-
|
|
61
|
-
// ----------------------------
|
|
62
|
-
|
|
63
|
-
match: {
|
|
64
|
-
value(str: string): boolean {
|
|
65
|
-
for (const item of this) {
|
|
66
|
-
if(typeof item === 'string' && (RegExp(item).exec(str))){
|
|
67
|
-
return true;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
return false;
|
|
71
|
-
},
|
|
72
|
-
enumerable : false,
|
|
73
|
-
writable : true,
|
|
74
|
-
},
|
|
75
|
-
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
// ===========================================
|
|
80
|
-
// Object
|
|
81
|
-
|
|
82
|
-
function isObjectDefined(obj: any): boolean {
|
|
83
|
-
return obj !== undefined && typeof(obj) === 'object' && obj !== null && (obj instanceof Date) === false && Array.isArray(obj) === false;
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
87
|
-
interface Object {
|
|
88
|
-
copy(maxDepth?: number, excludeKeysStart?: string[]): any;
|
|
89
|
-
diff(toObj: any, excludeKeysStart?: string[]): {from?: any; to?: any} | undefined;
|
|
90
|
-
pickKeys<O>(keys: keyof O[]): Partial<O>;
|
|
91
|
-
mergeFrom(fromObj: Record<string, any>, addFromObjKeys: boolean): void;
|
|
92
|
-
isEqual(toObj: Record<string, any>): boolean;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
Object.defineProperties(Object.prototype, {
|
|
96
|
-
|
|
97
|
-
copy: {
|
|
98
|
-
value(maxDepth?: number, excludeKeysStart?: string[]): any {
|
|
99
|
-
const maxDeep = maxDepth === undefined ? 5 : maxDepth - 1;
|
|
100
|
-
const excludeKeys = excludeKeysStart === undefined ? ['_', '$'] : excludeKeysStart;
|
|
101
|
-
|
|
102
|
-
const objCopy: Record<any, any> = {};
|
|
103
|
-
for(const key of Object.keys(this)){
|
|
104
|
-
if(excludeKeys.includes(key[0])){
|
|
105
|
-
continue;
|
|
106
|
-
}
|
|
107
|
-
|
|
108
|
-
const value = (this)[key];
|
|
109
|
-
|
|
110
|
-
if (isObjectDefined(value)) {
|
|
111
|
-
objCopy[key] = (maxDeep >= 0) ? value.copy(maxDeep, excludeKeys) : {};
|
|
112
|
-
} else {
|
|
113
|
-
objCopy[key] = value;
|
|
114
|
-
}
|
|
115
|
-
}
|
|
116
|
-
return objCopy;
|
|
117
|
-
},
|
|
118
|
-
enumerable : false,
|
|
119
|
-
writable : true,
|
|
120
|
-
},
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
// ----------------------------
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
diff: {
|
|
127
|
-
value(toObj: any, excludeKeysStart?: string[]): {from?: any; to?: any} | undefined{
|
|
128
|
-
if(isObjectDefined(toObj) === false){
|
|
129
|
-
return { from: this.copy(), to: toObj};
|
|
130
|
-
}
|
|
131
|
-
|
|
132
|
-
const excludeKeys = excludeKeysStart === undefined ? ['_', '$'] : excludeKeysStart;
|
|
133
|
-
|
|
134
|
-
const result: Record<any, any> = {};
|
|
135
|
-
|
|
136
|
-
const fromKeys = Object.keys(this);
|
|
137
|
-
const toKeys = Object.keys(toObj);
|
|
138
|
-
|
|
139
|
-
if(fromKeys.length === toKeys.length && toKeys.length === 0){
|
|
140
|
-
return undefined;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
for (const key of toKeys) {
|
|
144
|
-
|
|
145
|
-
const i = fromKeys.indexOf(key);
|
|
146
|
-
if(i !== -1){
|
|
147
|
-
fromKeys.splice(i, 1);
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
if(excludeKeys.includes(key[0])){
|
|
151
|
-
continue;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
const oldVal = (this)[ key ];
|
|
155
|
-
const newVal = toObj[ key ];
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
if(oldVal === newVal
|
|
159
|
-
|| (isObjectDefined(oldVal) && isObjectDefined(newVal) && Object.keys(oldVal).length === 0 && Object.keys(newVal).length === 0)
|
|
160
|
-
|| (oldVal instanceof Date && newVal instanceof Date && oldVal.getTime() === newVal.getTime())
|
|
161
|
-
){
|
|
162
|
-
continue;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
if(oldVal === undefined || oldVal === null || oldVal === '' || isObjectDefined(oldVal) && Object.keys(oldVal).length === 0){
|
|
166
|
-
result[ key ] = { to : newVal };
|
|
167
|
-
continue;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
if(isObjectDefined(oldVal) && isObjectDefined(newVal)){
|
|
172
|
-
const nestedResult = oldVal.diff(newVal);
|
|
173
|
-
|
|
174
|
-
if(nestedResult && Object.keys(nestedResult).length > 0){
|
|
175
|
-
result[ key ] = nestedResult;
|
|
176
|
-
}
|
|
177
|
-
continue;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
result[ key ] = {
|
|
181
|
-
from : oldVal,
|
|
182
|
-
to : newVal,
|
|
183
|
-
};
|
|
184
|
-
|
|
185
|
-
}
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
for (const key of fromKeys) {
|
|
189
|
-
|
|
190
|
-
if(excludeKeys.includes(key[0])){
|
|
191
|
-
continue;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
const oldVal = (this)[ key ];
|
|
195
|
-
|
|
196
|
-
if(oldVal !== undefined || oldVal !== null){
|
|
197
|
-
result[ key ] = {
|
|
198
|
-
from : oldVal,
|
|
199
|
-
};
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
return result;
|
|
205
|
-
},
|
|
206
|
-
enumerable : false,
|
|
207
|
-
writable : true,
|
|
208
|
-
},
|
|
209
|
-
|
|
210
|
-
// ----------------------------
|
|
211
|
-
|
|
212
|
-
pickKeys: {
|
|
213
|
-
value<O>(keys: keyof O[]): Partial<O> {
|
|
214
|
-
if(!Array.isArray(keys) || keys.length === 0) return {};
|
|
215
|
-
|
|
216
|
-
const obj: Partial<O> = {};
|
|
217
|
-
|
|
218
|
-
for (const key of keys) {
|
|
219
|
-
obj[ key as keyof O ] = (this)[ key ];
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
return obj;
|
|
223
|
-
},
|
|
224
|
-
enumerable : false,
|
|
225
|
-
writable : true,
|
|
226
|
-
},
|
|
227
|
-
|
|
228
|
-
// // ----------------------------
|
|
229
|
-
|
|
230
|
-
// applayObject: {
|
|
231
|
-
// value(fromObj: { [x: string]: any }, exeptKeys: string | string[]) {
|
|
232
|
-
// if(!fromObj || typeof fromObj !== 'object') return this;
|
|
233
|
-
|
|
234
|
-
// Object.keys(fromObj).forEach(key => {
|
|
235
|
-
|
|
236
|
-
// if(!exeptKeys || !Array.isArray(exeptKeys) || !exeptKeys.includes(key)){
|
|
237
|
-
// this[ key ] = fromObj[ key ];
|
|
238
|
-
// }
|
|
239
|
-
|
|
240
|
-
// });
|
|
241
|
-
|
|
242
|
-
// return this;
|
|
243
|
-
|
|
244
|
-
// },
|
|
245
|
-
// enumerable : false,
|
|
246
|
-
// writable : true,
|
|
247
|
-
// },
|
|
248
|
-
|
|
249
|
-
// ----------------------------
|
|
250
|
-
|
|
251
|
-
mergeFrom: {
|
|
252
|
-
value(fromObj: { [x: string]: any }, addFromObjKeys = true) {
|
|
253
|
-
|
|
254
|
-
if(!fromObj || typeof fromObj !== 'object') return this;
|
|
255
|
-
|
|
256
|
-
const keys = Object.keys(this);
|
|
257
|
-
|
|
258
|
-
const fromKeys = Object.keys(fromObj);
|
|
259
|
-
|
|
260
|
-
// Обходим те кулючи что у нас уже есть!
|
|
261
|
-
keys.forEach(key => {
|
|
262
|
-
|
|
263
|
-
const i = fromKeys.indexOf(key);
|
|
264
|
-
if(i !== -1){
|
|
265
|
-
fromKeys.splice(i, 1);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
const fromValue = fromObj[ key ];
|
|
269
|
-
if(fromValue === undefined || fromValue === null){
|
|
270
|
-
return;
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
if(typeof this[ key ] !== 'object' ||
|
|
274
|
-
typeof this[ key ] !== typeof fromValue ||
|
|
275
|
-
Array.isArray(this[ key ])){
|
|
276
|
-
this[ key ] = fromValue;
|
|
277
|
-
return;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
this[ key ].mergeFrom(fromValue);
|
|
281
|
-
|
|
282
|
-
});
|
|
283
|
-
|
|
284
|
-
// Добавляем те что есть только у fromObj
|
|
285
|
-
if(addFromObjKeys && fromKeys.length >0){
|
|
286
|
-
|
|
287
|
-
fromKeys.forEach(key => {
|
|
288
|
-
this[ key ] = fromObj[ key ];
|
|
289
|
-
});
|
|
290
|
-
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
return this;
|
|
294
|
-
|
|
295
|
-
},
|
|
296
|
-
enumerable : false,
|
|
297
|
-
writable : true,
|
|
298
|
-
},
|
|
299
|
-
|
|
300
|
-
// ----------------------------
|
|
301
|
-
|
|
302
|
-
isEqual: {
|
|
303
|
-
value(toObj: Record<string, any>): boolean{
|
|
304
|
-
const diff = this.diff(toObj);
|
|
305
|
-
|
|
306
|
-
return diff ? Object.keys(diff).length === 0 : true;
|
|
307
|
-
},
|
|
308
|
-
enumerable : false,
|
|
309
|
-
writable : true,
|
|
310
|
-
},
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
});
|
package/tsconfig.json
DELETED
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"compilerOptions": {
|
|
3
|
-
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
|
4
|
-
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
|
5
|
-
"lib": ["esnext", "DOM"], /* Specify library files to be included in the compilation. */
|
|
6
|
-
"allowJs": true, /* Allow javascript files to be compiled. */
|
|
7
|
-
"declaration": true, /* Generates corresponding '.d.ts' file. */
|
|
8
|
-
"declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
|
9
|
-
"sourceMap": true, /* Generates corresponding '.map' file. */
|
|
10
|
-
"outDir": "_publish", /* Redirect output structure to the directory. */
|
|
11
|
-
"removeComments": true, /* Do not emit comments to output. */
|
|
12
|
-
"preserveConstEnums": true,
|
|
13
|
-
"noEmitOnError": true, /* Do not emit outputs if any errors were reported. */
|
|
14
|
-
"strict": true, /* Enable all strict type-checking options. */
|
|
15
|
-
"resolveJsonModule": true,
|
|
16
|
-
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
|
17
|
-
"typeRoots": ["node_modules/@types", "../node_modules/@types"], /* List of folders to include type definitions from. */
|
|
18
|
-
"experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
|
19
|
-
"emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
|
20
|
-
"forceConsistentCasingInFileNames": true, /* Disallow inconsistently-cased references to the same file. */
|
|
21
|
-
"useUnknownInCatchVariables": false
|
|
22
|
-
},
|
|
23
|
-
"exclude": ["node_modules.", "_publish", "*.sh"]
|
|
24
|
-
}
|
package/upd_pkg.ts
DELETED
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env ts-node
|
|
2
|
-
import { promises as asyncFs } from 'fs';
|
|
3
|
-
|
|
4
|
-
main();
|
|
5
|
-
|
|
6
|
-
async function main() {
|
|
7
|
-
|
|
8
|
-
const pkg = JSON.parse(await asyncFs.readFile('./package.json', 'utf-8'));
|
|
9
|
-
|
|
10
|
-
let v = pkg.version;
|
|
11
|
-
const comp: string[] = v.split('.');
|
|
12
|
-
comp[ comp.length - 1 ] = `${ Number(comp[ comp.length - 1 ]) + 1 }`;
|
|
13
|
-
v = comp.join('.');
|
|
14
|
-
pkg.version = v;
|
|
15
|
-
|
|
16
|
-
await asyncFs.writeFile('./package.json', JSON.stringify(pkg, null, 3));
|
|
17
|
-
await asyncFs.writeFile('../package.json', JSON.stringify(pkg, null, 3)); // ts pkg
|
|
18
|
-
|
|
19
|
-
process.env.PUBLISH_VERSION = pkg.version;
|
|
20
|
-
|
|
21
|
-
}
|
package/xcode.ts
DELETED
|
@@ -1,226 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
import {program, OptionValues} from 'commander';
|
|
4
|
-
|
|
5
|
-
import Shell from './libs/Shell';
|
|
6
|
-
import Git from './libs/Git';
|
|
7
|
-
import {Jira} from './libs/Jira';
|
|
8
|
-
import { log, stripTags, checkEnvVars, resolvePath } from './libs/helpers';
|
|
9
|
-
import { Project } from './libs/Project';
|
|
10
|
-
import { Reporter } from './libs/Reporter';
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
const ENV = process.env;
|
|
14
|
-
|
|
15
|
-
// ========================================================
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
async function main() {
|
|
19
|
-
|
|
20
|
-
program
|
|
21
|
-
.option('--path <xcode project dir>', 'Path to Xcode project directory [default - current]')
|
|
22
|
-
.option('--scheme <Build scheme>', 'Xcode scheme to build and deploy')
|
|
23
|
-
.option('--debug', 'Output extra debugging info')
|
|
24
|
-
.action(
|
|
25
|
-
async () => {
|
|
26
|
-
|
|
27
|
-
let reporter: Reporter | undefined;
|
|
28
|
-
|
|
29
|
-
try {
|
|
30
|
-
|
|
31
|
-
// ------------------
|
|
32
|
-
// Инициализируемся
|
|
33
|
-
checkEnvVars(['SECRETS', 'REPORTER']);
|
|
34
|
-
// SECRETS: { bugsnag: { shema: token }, keychain: { path, password } }
|
|
35
|
-
|
|
36
|
-
const opts = program.opts() || {};
|
|
37
|
-
const prj = new Project(opts.path, opts.stage);
|
|
38
|
-
|
|
39
|
-
const reporterOpts = JSON.parse(ENV.REPORTER!);
|
|
40
|
-
reporterOpts.postTitle = opts.scheme;
|
|
41
|
-
|
|
42
|
-
reporter = new Reporter(prj, reporterOpts);
|
|
43
|
-
|
|
44
|
-
// Запускаем команду
|
|
45
|
-
await run(prj, reporter, opts);
|
|
46
|
-
|
|
47
|
-
} catch(e){
|
|
48
|
-
|
|
49
|
-
log.error(e);
|
|
50
|
-
|
|
51
|
-
if(reporter){
|
|
52
|
-
try {
|
|
53
|
-
await reporter.fail(e);
|
|
54
|
-
} catch(e2){
|
|
55
|
-
log.error(e2);
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
process.exit(1);
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
);
|
|
64
|
-
|
|
65
|
-
await program.parseAsync(process.argv);
|
|
66
|
-
}
|
|
67
|
-
main();
|
|
68
|
-
|
|
69
|
-
// ============================================
|
|
70
|
-
// SA CI IOS
|
|
71
|
-
|
|
72
|
-
async function run(prj: Project, reporter: Reporter, opts: OptionValues) {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
// ------------------
|
|
76
|
-
// Проверяем что есть изменения
|
|
77
|
-
const changedFiles = await Git.getDiffFiles();
|
|
78
|
-
|
|
79
|
-
if(changedFiles.length === 0){
|
|
80
|
-
log.info('SKIP BUILD: NO changedFiles found in repo');
|
|
81
|
-
process.exit(0);
|
|
82
|
-
} else {
|
|
83
|
-
log.info('START BUILD!');
|
|
84
|
-
log.info(changedFiles);
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
// ------------------
|
|
88
|
-
// Инициализируемся
|
|
89
|
-
const secrets = JSON.parse(ENV.SECRETS!);
|
|
90
|
-
const scheme = opts.scheme || 'iOS';
|
|
91
|
-
|
|
92
|
-
// Обрабатываем ситуацию когда в конфиге не валидные данные - берем из проекта билд и версию
|
|
93
|
-
const xcodeVersion = await Shell.exec(`xcodebuild -showBuildSettings -scheme ${ scheme } | grep MARKETING_VERSION | tr -d 'MARKETING_VERSION = '`, { silent: true });
|
|
94
|
-
const xcodeBuild = Number(await Shell.exec(`xcodebuild -showBuildSettings -scheme ${ scheme } | grep CURRENT_PROJECT_VERSION | tr -d 'CURRENT_PROJECT_VERSION = '`, { silent: true }));
|
|
95
|
-
|
|
96
|
-
const bundleID = await Shell.exec(`xcodebuild -showBuildSettings -scheme ${ scheme } | grep PRODUCT_BUNDLE_IDENTIFIER | tr -d 'PRODUCT_BUNDLE_IDENTIFIER = '`, { silent: true });
|
|
97
|
-
|
|
98
|
-
prj.build = prj.build < xcodeBuild ? xcodeBuild : prj.build;
|
|
99
|
-
prj.version = `${ xcodeVersion }.${ prj.build }`;
|
|
100
|
-
|
|
101
|
-
// 1. BUILD ------------------------
|
|
102
|
-
prj.incrementBuild();
|
|
103
|
-
await reporter.startBuild();
|
|
104
|
-
|
|
105
|
-
await fastlane('increment_build_number', { build_number: prj.build });
|
|
106
|
-
|
|
107
|
-
log.info('unlock_keychain');
|
|
108
|
-
|
|
109
|
-
await fastlane('unlock_keychain', {
|
|
110
|
-
path: resolvePath(secrets.keychain.path),
|
|
111
|
-
password: secrets.keychain.password,
|
|
112
|
-
set_default: true,
|
|
113
|
-
},
|
|
114
|
-
{ silent: true });
|
|
115
|
-
|
|
116
|
-
await reporter.send(` + Build & archive xcode project.`);
|
|
117
|
-
await fastlane('build_app', {
|
|
118
|
-
scheme,
|
|
119
|
-
configuration: 'Release',
|
|
120
|
-
silent: false,
|
|
121
|
-
export_method: 'app-store',
|
|
122
|
-
xcargs: '-allowProvisioningUpdates',
|
|
123
|
-
include_bitcode: true,
|
|
124
|
-
}, { verbose: '' });
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
// 2. RELEASE INFO ------------------------
|
|
128
|
-
|
|
129
|
-
const release = await Jira.resolve(prj);
|
|
130
|
-
await reporter.send(` + Resolved tasks:${ release.tasks.length }, bugs: ${ release.bugs.length }`);
|
|
131
|
-
|
|
132
|
-
await Shell.exec(`git reset --hard HEAD`, { silent: false });
|
|
133
|
-
await prj.updateChangeLog(release.changelog);
|
|
134
|
-
|
|
135
|
-
await Git.setOrigin();
|
|
136
|
-
await Shell.exec(`git commit -a -m "v${ prj.version }"`, { ignoreError: true, silent:false });
|
|
137
|
-
await Git.push(ENV.CI_COMMIT_REF_NAME || 'dev');
|
|
138
|
-
await reporter.send(` + Update <a href="${ prj.url }/-/blob/${ ENV.CI_COMMIT_REF_NAME || 'dev' }/CHANGELOG.md">changelog</a>.`);
|
|
139
|
-
|
|
140
|
-
await reporter.send(` + Git tag new version`);
|
|
141
|
-
await Git.makeTag(prj.version);
|
|
142
|
-
|
|
143
|
-
await reporter.send(` + Save build: ${ prj.build} to GitLab`);
|
|
144
|
-
await prj.saveGitLabBuild();
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
// 3. DEPLOY ARCHIVE ------------------------
|
|
148
|
-
await reporter.deploy('testfight');
|
|
149
|
-
await reporter.send(` + Upload to Testfilght.`);
|
|
150
|
-
await fastlane('upload_to_testflight', {
|
|
151
|
-
api_key_path: ENV.TESTFLIGHT,
|
|
152
|
-
changelog: stripTags(release.changelog),
|
|
153
|
-
}, { attempts: 3, verbose: '' });
|
|
154
|
-
|
|
155
|
-
// 4. UPLOAD DSYMS ------------------------
|
|
156
|
-
|
|
157
|
-
if(secrets.bugsnag[ scheme ]){
|
|
158
|
-
|
|
159
|
-
await reporter.send(` + Download DSYMs.`);
|
|
160
|
-
await fastlane('download_dsyms', {
|
|
161
|
-
api_key_path: ENV.TESTFLIGHT_KEY,
|
|
162
|
-
version: prj.shortVersion,
|
|
163
|
-
build_number: prj.build,
|
|
164
|
-
app_identifier: bundleID,
|
|
165
|
-
wait_for_dsym_processing: true,
|
|
166
|
-
output_directory: prj.rootPath,
|
|
167
|
-
}, {
|
|
168
|
-
attempts: 10, sleep: 120, silent: false, ignoreError: true,
|
|
169
|
-
});
|
|
170
|
-
|
|
171
|
-
await reporter.send(` + Upload DSYMs to BugSnag.`);
|
|
172
|
-
const cmd = `bugsnag-dsym-upload --api-key ${ secrets.bugsnag[ scheme ] } --project-root ./ ${ prj.rootPath }/${bundleID}-${prj.shortVersion}-${prj.build}.dSYM.zip`;
|
|
173
|
-
await Shell.execRepeat(cmd, 10, 120, { silent: false, ignoreError: true });
|
|
174
|
-
|
|
175
|
-
} else {
|
|
176
|
-
await reporter.send(` - Upload DSYMs to BugSnag. [SKIPED]`);
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
// 5. RELEASE ------------------------
|
|
180
|
-
|
|
181
|
-
await reporter.send(` + Resolved tasks:${ release.tasks.length }, bugs: ${ release.bugs.length }`);
|
|
182
|
-
|
|
183
|
-
const bugsDeployed = await Jira.moveBugsAsDeployed(release.bugs);
|
|
184
|
-
if(bugsDeployed.length > 0){
|
|
185
|
-
await reporter.send(` + Deployed ${ bugsDeployed.length } bugs.`);
|
|
186
|
-
} else {
|
|
187
|
-
await reporter.send(` - Deploy bugs. [SKIPED]`);
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
await reporter.send(` + Save ${ prj.stage} -> ${ prj.version} to GitLab`);
|
|
191
|
-
await prj.saveGitLabStagesVersions();
|
|
192
|
-
|
|
193
|
-
// FINISH!
|
|
194
|
-
await reporter.release(release.changelog);
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// ----------------------------
|
|
200
|
-
// HELPERS
|
|
201
|
-
|
|
202
|
-
function fastlane(action: string, pars: Record<string, any> = {}, { silent = false, attempts = 1, sleep = 60, ignoreError = false, verbose = '--verbose' } = {}) {
|
|
203
|
-
|
|
204
|
-
let params = '';
|
|
205
|
-
for (const key of Object.keys(pars)) {
|
|
206
|
-
|
|
207
|
-
switch (typeof pars[key]) {
|
|
208
|
-
case 'object':
|
|
209
|
-
params += ` ${ key }:"${ JSON.stringify(pars[key]) }"`;
|
|
210
|
-
break;
|
|
211
|
-
|
|
212
|
-
case 'string':
|
|
213
|
-
params += ` ${ key }:"${ pars[key] }"`;
|
|
214
|
-
break;
|
|
215
|
-
case 'number':
|
|
216
|
-
params += ` ${ key }:${ pars[key] }`;
|
|
217
|
-
break;
|
|
218
|
-
|
|
219
|
-
default:
|
|
220
|
-
params += ` ${ key } `;
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
return Shell.execRepeat(`fastlane run ${ action } ${ params } ${ verbose }`, attempts, sleep, { silent, ignoreError });
|
|
225
|
-
}
|
|
226
|
-
|