polyci 0.0.23 → 0.0.26

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 +11 -26
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -120,7 +120,7 @@ function detectModuleType(directory) {
120
120
  catch (error) {
121
121
  log.warn({ directory, error }, "Unable to read package.json while detecting module type");
122
122
  }
123
- return null;
123
+ return "npm-package";
124
124
  }
125
125
  function discoverModulesRecursively(repoRoot, modulesRoot, scanDir, modules) {
126
126
  const moduleType = detectModuleType(scanDir);
@@ -306,6 +306,7 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, versionTemplate, bra
306
306
  for (const module of modules) {
307
307
  lines.push(` - ${module.modulePath}/dist`);
308
308
  lines.push(` - ${module.modulePath}/deploy.env`);
309
+ lines.push(` - ${module.modulePath}/package.json`);
309
310
  }
310
311
  lines.push(` expire_in: 1 day`);
311
312
  lines.push(``);
@@ -325,15 +326,14 @@ function appendModulePublishJob(lines, module) {
325
326
  lines.push(` MODULE_PATH: ${module.modulePath}`);
326
327
  lines.push(` MODULE_TYPE: ${module.moduleType}`);
327
328
  lines.push(` script:`);
328
- lines.push(` - cp ci/$MODULE_TYPE/Dockerfile $MODULE_PATH`);
329
- lines.push(` - cd $MODULE_PATH`);
329
+ lines.push(` - cp -r ci "${module.modulePath}/ci`);
330
+ lines.push(` - cd ${module.modulePath}`);
330
331
  lines.push(` - source deploy.env`);
331
- lines.push(` - echo -n $CI_JOB_TOKEN | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY`);
332
- lines.push(` - docker build --tag $CI_REGISTRY_IMAGE/$MODULE_NAME:v$INSTANCE_VERSION .`);
333
- lines.push(` - docker push $CI_REGISTRY_IMAGE/$MODULE_NAME:v$INSTANCE_VERSION`);
332
+ lines.push(` - source "ci/${module.moduleType}/publish.sh"`);
334
333
  lines.push(` artifacts:`);
335
334
  lines.push(` paths:`);
336
- lines.push(` - $MODULE_PATH/deploy.env`);
335
+ lines.push(` - ${module.modulePath}/deploy.env`);
336
+ lines.push(` - ${module.modulePath}/package.json`);
337
337
  lines.push(` expire_in: 1 day`);
338
338
  lines.push(``);
339
339
  }
@@ -351,25 +351,10 @@ function appendModuleDeployJob(lines, module) {
351
351
  lines.push(` MODULE_PATH: ${module.modulePath}`);
352
352
  lines.push(` MODULE_TYPE: ${module.moduleType}`);
353
353
  lines.push(` script:`);
354
- lines.push(` - source $MODULE_PATH/deploy.env`);
355
- lines.push(` - export INSTANCE_HOST`);
356
- lines.push(` - export INSTANCE_CONTAINER `);
357
- lines.push(` - export INSTANCE_VERSION`);
358
- lines.push(` - apk add --update --no-cache openssh-client-default`);
359
- lines.push(` - eval $(ssh-agent -s)`);
360
- lines.push(` - echo "$DEPLOY_USER_KEY" | tr -d '\\r' | ssh-add -`);
361
- lines.push(` - mkdir -p ~/.ssh`);
362
- lines.push(` - chmod 700 ~/.ssh`);
363
- lines.push(` - ssh-keyscan -p $DEPLOY_PORT $DEPLOY_ADDRESS >> ~/.ssh/known_hosts`);
364
- lines.push(` - chmod 644 ~/.ssh/known_hosts`);
365
- lines.push(` - echo -n $CI_JOB_TOKEN | docker login -u $CI_REGISTRY_USER --password-stdin $CI_REGISTRY`);
366
- lines.push(` - docker context create remote --docker "host=ssh://$DEPLOY_USER@$DEPLOY_ADDRESS:$DEPLOY_PORT"`);
367
- lines.push(` - cd ci`);
368
- lines.push(` - export DOCKER_API_VERSION=1.41`);
369
- lines.push(` - docker --context remote compose -p $INSTANCE_CONTAINER down --remove-orphans`);
370
- lines.push(` - docker --context remote compose pull`);
371
- lines.push(` - docker --context remote compose -p $INSTANCE_CONTAINER up -d`);
372
- lines.push(` - rm -rf ~/.ssh`);
354
+ lines.push(` - cp -r ci "${module.modulePath}/ci"`);
355
+ lines.push(` - cd ${module.modulePath}`);
356
+ lines.push(` - source deploy.env`);
357
+ lines.push(` - source "ci/${module.moduleType}/deploy.sh"`);
373
358
  lines.push(``);
374
359
  }
375
360
  function buildPipeline(modules, mainBranch, versionTemplate, branchVersionTemplate, tagTemplate, tagPattern) {
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.23",
4
+ "version": "0.0.26",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "author": "Alexander Tsarev",