polyci 0.0.3 → 0.0.5

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.
Files changed (2) hide show
  1. package/dist/main.js +33 -30
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -111,8 +111,8 @@ function appendModuleBuildJob(lines, module, branchRule) {
111
111
  lines.push(`${module.jobId}_build:`);
112
112
  lines.push(" stage: build");
113
113
  lines.push(" rules:");
114
- lines.push(" changes:");
115
- lines.push(` - ${module.modulePath}/**/*`);
114
+ lines.push(" - changes:");
115
+ lines.push(` - ${module.modulePath}/**/*`);
116
116
  lines.push(" image: $IMAGE_NODE");
117
117
  lines.push(" variables:");
118
118
  lines.push(` MODULE_NAME: ${module.moduleName}`);
@@ -132,8 +132,8 @@ function appendModuleTestJob(lines, module, branchRule) {
132
132
  lines.push(`${module.jobId}_test:`);
133
133
  lines.push(" stage: test");
134
134
  lines.push(" rules:");
135
- lines.push(" changes:");
136
- lines.push(` - ${module.modulePath}/**/*`);
135
+ lines.push(" - changes:");
136
+ lines.push(` - ${module.modulePath}/**/*`);
137
137
  lines.push(" needs:");
138
138
  lines.push(` - job: ${module.jobId}_build`);
139
139
  lines.push(" image: $IMAGE_LINUX");
@@ -150,8 +150,8 @@ function appendModuleReleaseJob(lines, module, branchRule) {
150
150
  lines.push(`${module.jobId}_release:`);
151
151
  lines.push(" stage: release");
152
152
  lines.push(" rules:");
153
- lines.push(" changes:");
154
- lines.push(` - ${module.modulePath}/**/*`);
153
+ lines.push(" - changes:");
154
+ lines.push(` - ${module.modulePath}/**/*`);
155
155
  lines.push(" needs:");
156
156
  lines.push(` - job: ${module.jobId}_build`);
157
157
  lines.push(` - job: ${module.jobId}_test`);
@@ -217,31 +217,34 @@ function appendGlobalReleaseJob(lines, modules) {
217
217
  lines.push("");
218
218
  for (const module of modules) {
219
219
  lines.push(` echo "Tagging release for ${module.moduleName} (${module.modulePath})"`);
220
- lines.push(` if [ ! -f "${module.modulePath}/semalease.env" ]; then`);
221
- lines.push(` echo "Missing ${module.modulePath}/semalease.env, skipping ${module.moduleName}"`);
222
- lines.push(" continue");
223
- lines.push(" fi");
224
- lines.push(` source "${module.modulePath}/semalease.env"`);
225
- lines.push(" if [ \"$CI_COMMIT_BRANCH\" = \"main\" ]; then");
226
- lines.push(" if [ \"${NEXT_VERSION:-}\" = \"${LATEST_VERSION:-}\" ]; then");
227
- lines.push(` echo "Version did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
228
- lines.push(" continue");
220
+ lines.push(` if [ -f "${module.modulePath}/semalease.env" ]; then`);
221
+ lines.push(` . "${module.modulePath}/semalease.env"`);
222
+ lines.push(" TAG_NAME=\"\"");
223
+ lines.push(" if [ \"$CI_COMMIT_BRANCH\" = \"main\" ]; then");
224
+ lines.push(" if [ \"${NEXT_VERSION:-}\" != \"${LATEST_VERSION:-}\" ]; then");
225
+ lines.push(` TAG_NAME="${module.moduleName}-v\${NEXT_VERSION}"`);
226
+ lines.push(" else");
227
+ lines.push(` echo "Version did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
228
+ lines.push(" fi");
229
+ lines.push(" else");
230
+ lines.push(" if [ \"${NEXT_VERSION:-}\" != \"${LATEST_VERSION:-}\" ] || [ \"${NEXT_INCREMENT:-}\" != \"${LATEST_INCREMENT:-}\" ]; then");
231
+ lines.push(` TAG_NAME="${module.moduleName}-v\${NEXT_VERSION}-\${CI_COMMIT_BRANCH}-\${NEXT_INCREMENT}"`);
232
+ lines.push(" else");
233
+ lines.push(` echo "Version/increment did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
234
+ lines.push(" fi");
229
235
  lines.push(" fi");
230
- lines.push(` TAG_NAME="${module.moduleName}-v\${NEXT_VERSION}"`);
231
- lines.push(" else");
232
- lines.push(" if [ \"${NEXT_VERSION:-}\" = \"${LATEST_VERSION:-}\" ] && [ \"${NEXT_INCREMENT:-}\" = \"${LATEST_INCREMENT:-}\" ]; then");
233
- lines.push(` echo "Version/increment did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
234
- lines.push(" continue");
235
- lines.push(" fi");
236
- lines.push(` TAG_NAME="${module.moduleName}-v\${NEXT_VERSION}-\${CI_COMMIT_BRANCH}-\${NEXT_INCREMENT}"`);
237
- lines.push(" fi");
236
+ lines.push(" if [ \"$TAG_NAME\" != \"\" ]; then");
238
237
  if (module.moduleType === "node-express") {
239
- lines.push(` git add "${module.modulePath}/package.json"`);
238
+ lines.push(` git add "${module.modulePath}/package.json"`);
240
239
  }
241
240
  else if (module.moduleType === "node-vite") {
242
- lines.push(` git add "${module.modulePath}/package.json" "${module.modulePath}/public/release.json"`);
241
+ lines.push(` git add "${module.modulePath}/package.json" "${module.modulePath}/public/release.json"`);
243
242
  }
244
- lines.push(" git tag \"${TAG_NAME}\"");
243
+ lines.push(" git tag \"$TAG_NAME\"");
244
+ lines.push(" fi");
245
+ lines.push(" else");
246
+ lines.push(` echo "Missing ${module.modulePath}/semalease.env, skipping ${module.moduleName}"`);
247
+ lines.push(" fi");
245
248
  }
246
249
  lines.push("");
247
250
  lines.push(" git commit -m \"release: update affected modules\"");
@@ -260,8 +263,8 @@ function appendModulePublishJob(lines, module, branchRule) {
260
263
  lines.push(`${module.jobId}_publish:`);
261
264
  lines.push(" stage: publish");
262
265
  lines.push(" rules:");
263
- lines.push(" changes:");
264
- lines.push(` - ${module.modulePath}/**/*`);
266
+ lines.push(" - changes:");
267
+ lines.push(` - ${module.modulePath}/**/*`);
265
268
  lines.push(" needs:");
266
269
  lines.push(` - job: ${module.jobId}_test`);
267
270
  lines.push(" - job: release_and_tag");
@@ -288,8 +291,8 @@ function appendModuleDeployJob(lines, module, branchRule) {
288
291
  lines.push(`${module.jobId}_deploy:`);
289
292
  lines.push(" stage: deploy");
290
293
  lines.push(" rules:");
291
- lines.push(" changes:");
292
- lines.push(` - ${module.modulePath}/**/*`);
294
+ lines.push(" - changes:");
295
+ lines.push(` - ${module.modulePath}/**/*`);
293
296
  lines.push(" needs:");
294
297
  lines.push(` - job: ${module.jobId}_publish`);
295
298
  lines.push(" image: $IMAGE_COMPOSE");
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "polyci",
3
3
  "description": "Monorepo CI/CD utilities.",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "author": "Alexander Tsarev",