polyci 0.0.7 → 0.0.8

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 +31 -29
  2. package/package.json +1 -1
package/dist/main.js CHANGED
@@ -217,6 +217,7 @@ function appendModuleReleaseJob(lines, module) {
217
217
  lines.push(` else`);
218
218
  lines.push(` PACKAGE_VERSION="$NEXT_VERSION-$CI_COMMIT_BRANCH-$NEXT_INCREMENT"`);
219
219
  lines.push(` fi`);
220
+ lines.push(" - |");
220
221
  lines.push(` if [ "$MODULE_TYPE" = "node-express" ]; then`);
221
222
  lines.push(` node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version=process.env.PACKAGE_VERSION; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\\n');"`);
222
223
  lines.push(` node ci/prepare-deploy-variables.js --instance-branch $CI_COMMIT_BRANCH`);
@@ -252,46 +253,47 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, tagTemplate, branchT
252
253
  lines.push(" script:");
253
254
  lines.push(" - apk update");
254
255
  lines.push(" - apk add $GIT_PACKAGE");
255
- lines.push(" - |");
256
- lines.push(" set -euo pipefail");
257
- lines.push(" git config user.email \"polyci@anarun.net\"");
258
- lines.push(" git config user.name \"polyci\"");
259
- lines.push(" git remote set-url origin \"https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"");
260
- lines.push(" TAG_CREATED=false");
256
+ lines.push(" - set -euo pipefail");
257
+ lines.push(" - git config user.email \"polyci@anarun.net\"");
258
+ lines.push(" - git config user.name \"polyci\"");
259
+ lines.push(" - git remote set-url origin \"https://oauth2:${GITLAB_TOKEN}@${CI_SERVER_HOST}/${CI_PROJECT_PATH}.git\"");
260
+ lines.push(" - TAG_CREATED=false");
261
261
  lines.push("");
262
262
  for (const module of modules) {
263
- lines.push(` echo "Tagging release for ${module.moduleName} (${module.modulePath})"`);
264
- lines.push(` if [ -f "${module.modulePath}/semalease.env" ]; then`);
265
- lines.push(` . "${module.modulePath}/semalease.env"`);
266
- lines.push(" TAG_NAME=\"\"");
267
- lines.push(` if [ "$CI_COMMIT_BRANCH" = "${mainBranch}" ]; then`);
268
- lines.push(" if [ \"${NEXT_VERSION:-}\" != \"${LATEST_VERSION:-}\" ]; then");
269
- lines.push(` TAG_NAME="${applyTagTemplate(tagTemplate, module.moduleName)}"`);
270
- lines.push(" else");
271
- lines.push(` echo "Version did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
272
- lines.push(" fi");
263
+ lines.push(` - echo "Tagging release for ${module.moduleName} (${module.modulePath})"`);
264
+ lines.push(" - |");
265
+ lines.push(` if [ -f "${module.modulePath}/semalease.env" ]; then`);
266
+ lines.push(` . "${module.modulePath}/semalease.env"`);
267
+ lines.push(" TAG_NAME=\"\"");
268
+ lines.push(` if [ "$CI_COMMIT_BRANCH" = "${mainBranch}" ]; then`);
269
+ lines.push(" if [ \"${NEXT_VERSION:-}\" != \"${LATEST_VERSION:-}\" ]; then");
270
+ lines.push(` TAG_NAME="${applyTagTemplate(tagTemplate, module.moduleName)}"`);
271
+ lines.push(" else");
272
+ lines.push(` echo "Version did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
273
+ lines.push(" fi");
274
+ lines.push(" else");
275
+ lines.push(" if [ \"${NEXT_VERSION:-}\" != \"${LATEST_VERSION:-}\" ] || [ \"${NEXT_INCREMENT:-}\" != \"${LATEST_INCREMENT:-}\" ]; then");
276
+ lines.push(` TAG_NAME="${applyTagTemplate(branchTagTemplate, module.moduleName)}"`);
273
277
  lines.push(" else");
274
- lines.push(" if [ \"${NEXT_VERSION:-}\" != \"${LATEST_VERSION:-}\" ] || [ \"${NEXT_INCREMENT:-}\" != \"${LATEST_INCREMENT:-}\" ]; then");
275
- lines.push(` TAG_NAME="${applyTagTemplate(branchTagTemplate, module.moduleName)}"`);
276
- lines.push(" else");
277
- lines.push(` echo "Version/increment did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
278
- lines.push(" fi");
278
+ lines.push(` echo "Version/increment did not change for ${module.moduleName} on branch $CI_COMMIT_BRANCH, skipping tag"`);
279
279
  lines.push(" fi");
280
- lines.push(" if [ \"$TAG_NAME\" != \"\" ]; then");
280
+ lines.push(" fi");
281
+ lines.push(" if [ \"$TAG_NAME\" != \"\" ]; then");
281
282
  if (module.moduleType === "node-express") {
282
- lines.push(` git add "${module.modulePath}/package.json"`);
283
+ lines.push(` git add "${module.modulePath}/package.json"`);
283
284
  }
284
285
  else if (module.moduleType === "node-vite") {
285
- lines.push(` git add "${module.modulePath}/package.json" "${module.modulePath}/public/release.json"`);
286
+ lines.push(` git add "${module.modulePath}/package.json" "${module.modulePath}/public/release.json"`);
286
287
  }
287
- lines.push(" git tag \"$TAG_NAME\"");
288
- lines.push(" TAG_CREATED=true");
289
- lines.push(" fi");
290
- lines.push(" else");
291
- lines.push(` echo "Missing ${module.modulePath}/semalease.env, skipping ${module.moduleName}"`);
288
+ lines.push(" git tag \"$TAG_NAME\"");
289
+ lines.push(" TAG_CREATED=true");
292
290
  lines.push(" fi");
291
+ lines.push(" else");
292
+ lines.push(` echo "Missing ${module.modulePath}/semalease.env, skipping ${module.moduleName}"`);
293
+ lines.push(" fi");
293
294
  }
294
295
  lines.push("");
296
+ lines.push(" - |");
295
297
  lines.push(" if [ \"$TAG_CREATED\" = true ]; then");
296
298
  lines.push(" git commit -m \"release: update affected modules\"");
297
299
  lines.push(" git push origin HEAD");
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.7",
4
+ "version": "0.0.8",
5
5
  "type": "module",
6
6
  "private": false,
7
7
  "author": "Alexander Tsarev",