polyci 0.1.4 → 0.1.6

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 +16 -8
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -162,12 +162,9 @@ function appendGlobalVariables(lines) {
162
162
  lines.push(`variables:`);
163
163
  lines.push(` IMAGE_LINUX: alpine:latest`);
164
164
  lines.push(` IMAGE_NODE: node:alpine`);
165
- lines.push(` IMAGE_GIT: alpine/git:latest`);
166
- lines.push(` IMAGE_NGINX: nginx:alpine-slim`);
167
- lines.push(` IMAGE_DOCKER: docker:latest`);
168
- lines.push(` IMAGE_COMPOSE: docker:cli`);
169
165
  lines.push(` GIT_PACKAGE: git`);
170
166
  lines.push(` GIT_STRATEGY: clone`); //this prevents the stale tags in the ci job.
167
+ lines.push(` GIT_DEPTH: 0`); //this prevents the shallow tags in the ci job.
171
168
  lines.push(``);
172
169
  lines.push(`stages:`);
173
170
  lines.push(` - build`);
@@ -293,6 +290,7 @@ function appendGlobalReleaseJob(lines, modules) {
293
290
  lines.push(` - git config user.name "polyci"`);
294
291
  lines.push(` - git remote set-url origin "https://oauth2:\${POLYCI_TOKEN}@\${CI_SERVER_HOST}/\${CI_PROJECT_PATH}.git"`);
295
292
  lines.push(` - TAG_NAMES=""`);
293
+ lines.push(` - RELEASE_MESSAGE=""`);
296
294
  lines.push(``);
297
295
  for (const module of modules) {
298
296
  lines.push(` - |`);
@@ -309,13 +307,14 @@ function appendGlobalReleaseJob(lines, modules) {
309
307
  lines.push(` source "ci/${module.moduleType}/release.sh"`);
310
308
  lines.push(` cd "$ROOT_REPO_DIR"`);
311
309
  lines.push(` TAG_NAMES="\${TAG_NAMES} \${PLI_MODULE_TAG}"`);
310
+ lines.push(` RELEASE_MESSAGE="\${RELEASE_MESSAGE}\${RELEASE_MESSAGE:+, }\${PLI_MODULE_NAME} (\${PLI_MODULE_VERSION})"`);
312
311
  lines.push(` fi`);
313
312
  lines.push(` fi`);
314
313
  }
315
314
  lines.push(``);
316
315
  lines.push(` - |`);
317
316
  lines.push(` if [ -n "$TAG_NAMES" ]; then`);
318
- lines.push(` git commit --allow-empty -m "release: ${modules.map((m) => m.moduleName).join(", ")}"`);
317
+ lines.push(` git commit --allow-empty -m "release: \${RELEASE_MESSAGE}"`);
319
318
  lines.push(` for TAG_NAME in \${TAG_NAMES}; do`);
320
319
  lines.push(` git tag "\${TAG_NAME}"`);
321
320
  lines.push(` done`);
@@ -341,7 +340,6 @@ function appendModulePublishJob(lines, module) {
341
340
  lines.push(` - changes:`);
342
341
  lines.push(` - ${module.modulePath}/**/*`);
343
342
  lines.push(` needs:`);
344
- lines.push(` - job: ${module.moduleName}-test`);
345
343
  lines.push(` - job: release`);
346
344
  lines.push(` image: $IMAGE_NODE`);
347
345
  lines.push(` script:`);
@@ -350,7 +348,12 @@ function appendModulePublishJob(lines, module) {
350
348
  lines.push(` - cd ${module.modulePath}`);
351
349
  lines.push(` - cat polyci.env`);
352
350
  lines.push(` - source polyci.env`);
353
- lines.push(` - source "ci/${module.moduleType}/publish.sh"`);
351
+ lines.push(` - |`);
352
+ lines.push(` if [ -n "\${PLI_MODULE_VERSION:-}" ]; then`);
353
+ lines.push(` source "ci/${module.moduleType}/publish.sh"`);
354
+ lines.push(` else`);
355
+ lines.push(` echo "No new version. Skipping publish."`);
356
+ lines.push(` fi`);
354
357
  lines.push(` artifacts:`);
355
358
  lines.push(` paths:`);
356
359
  lines.push(` - ${module.modulePath}/polyci.env`);
@@ -372,7 +375,12 @@ function appendModuleDeployJob(lines, module) {
372
375
  lines.push(` - cd ${module.modulePath}`);
373
376
  lines.push(` - cat polyci.env`);
374
377
  lines.push(` - source polyci.env`);
375
- lines.push(` - source "ci/${module.moduleType}/deploy.sh"`);
378
+ lines.push(` - |`);
379
+ lines.push(` if [ -n "\${PLI_MODULE_VERSION:-}" ]; then`);
380
+ lines.push(` source "ci/${module.moduleType}/deploy.sh"`);
381
+ lines.push(` else`);
382
+ lines.push(` echo "No new version. Skipping deploy."`);
383
+ lines.push(` fi`);
376
384
  lines.push(``);
377
385
  }
378
386
  function buildPipeline(modules, mainBranch, versionTemplate, branchVersionTemplate, tagTemplate, tagPattern, branchTagPattern) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "polyci",
3
3
  "description": "Monorepo CI/CD utilities.",
4
- "version": "0.1.4",
4
+ "version": "0.1.6",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "author": "Alexander Tsarev",