polyci 0.0.10 → 0.0.12
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/dist/main.js +14 -11
- package/package.json +1 -1
package/dist/main.js
CHANGED
|
@@ -141,6 +141,7 @@ function appendGlobalVariables(lines) {
|
|
|
141
141
|
lines.push(` IMAGE_DOCKER: docker:latest`);
|
|
142
142
|
lines.push(` IMAGE_COMPOSE: docker:cli`);
|
|
143
143
|
lines.push(` GIT_PACKAGE: git`);
|
|
144
|
+
lines.push(` GIT_STRATEGY: clone`); //this prevents the stale tags in the ci job.
|
|
144
145
|
lines.push(``);
|
|
145
146
|
lines.push(`stages:`);
|
|
146
147
|
lines.push(` - build`);
|
|
@@ -209,7 +210,7 @@ function appendModuleReleaseJob(lines, module) {
|
|
|
209
210
|
lines.push(` - cp -r ci $MODULE_PATH/ci`);
|
|
210
211
|
lines.push(` - cd $MODULE_PATH`);
|
|
211
212
|
lines.push(` - npm ci`);
|
|
212
|
-
lines.push(` - git tag -l "
|
|
213
|
+
lines.push(` - git tag -l "^${module.moduleName}-v(?<version>\\d+(\\.\\d+)*)-$CI_COMMIT_BRANCH-(?<increment>\\d+(\\.\\d+)*)$"`);
|
|
213
214
|
lines.push(` - npx semalease --tag-pattern "^${module.moduleName}-v(?<version>\\d+(\\.\\d+)*)-$CI_COMMIT_BRANCH-(?<increment>\\d+(\\.\\d+)*)$" semalease.env`);
|
|
214
215
|
lines.push(` - source semalease.env`);
|
|
215
216
|
lines.push(` - |`);
|
|
@@ -220,11 +221,11 @@ function appendModuleReleaseJob(lines, module) {
|
|
|
220
221
|
lines.push(` fi`);
|
|
221
222
|
lines.push(` - |`);
|
|
222
223
|
lines.push(` if [ "$MODULE_TYPE" = "node-express" ]; then`);
|
|
223
|
-
lines.push(` node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version=process.
|
|
224
|
+
lines.push(` node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version=process.argv[1]; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\\n');" "$PACKAGE_VERSION"`);
|
|
224
225
|
lines.push(` node ci/prepare-deploy-variables.js --instance-branch $CI_COMMIT_BRANCH`);
|
|
225
226
|
lines.push(` elif [ "$MODULE_TYPE" = "node-vite" ]; then`);
|
|
226
|
-
lines.push(` node ci/set-release-data.js -i $CI_COMMIT_BRANCH --version=$
|
|
227
|
-
lines.push(` node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version=process.
|
|
227
|
+
lines.push(` node ci/set-release-data.js -i $CI_COMMIT_BRANCH --version=$PACKAGE_VERSION -t`);
|
|
228
|
+
lines.push(` node -e "const fs=require('fs'); const pkg=JSON.parse(fs.readFileSync('package.json','utf8')); pkg.version=process.argv[1]; fs.writeFileSync('package.json', JSON.stringify(pkg, null, 2) + '\\n');" "$PACKAGE_VERSION"`);
|
|
228
229
|
lines.push(` node ci/prepare-deploy-variables.js --instance-branch $CI_COMMIT_BRANCH`);
|
|
229
230
|
lines.push(` else`);
|
|
230
231
|
lines.push(` echo "Invalid module type: $MODULE_TYPE"`);
|
|
@@ -258,7 +259,7 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, tagTemplate, branchT
|
|
|
258
259
|
lines.push(` - git config user.email "polyci@anarun.net"`);
|
|
259
260
|
lines.push(` - git config user.name "polyci"`);
|
|
260
261
|
lines.push(` - git remote set-url origin "https://oauth2:\${GITLAB_TOKEN}@\${CI_SERVER_HOST}/\${CI_PROJECT_PATH}.git"`);
|
|
261
|
-
lines.push(` -
|
|
262
|
+
lines.push(` - TAG_NAMES=""`);
|
|
262
263
|
lines.push(``);
|
|
263
264
|
for (const module of modules) {
|
|
264
265
|
lines.push(` - echo "Tagging release for ${module.moduleName} (${module.modulePath})"`);
|
|
@@ -286,8 +287,7 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, tagTemplate, branchT
|
|
|
286
287
|
else if (module.moduleType === "node-vite") {
|
|
287
288
|
lines.push(` git add "${module.modulePath}/package.json" "${module.modulePath}/public/release.json"`);
|
|
288
289
|
}
|
|
289
|
-
lines.push(`
|
|
290
|
-
lines.push(` TAG_CREATED=true`);
|
|
290
|
+
lines.push(` TAG_NAMES="\${TAG_NAMES} \${TAG_NAME}"`);
|
|
291
291
|
lines.push(` fi`);
|
|
292
292
|
lines.push(` else`);
|
|
293
293
|
lines.push(` echo "Missing ${module.modulePath}/semalease.env, skipping ${module.moduleName}"`);
|
|
@@ -295,10 +295,12 @@ function appendGlobalReleaseJob(lines, modules, mainBranch, tagTemplate, branchT
|
|
|
295
295
|
}
|
|
296
296
|
lines.push(``);
|
|
297
297
|
lines.push(` - |`);
|
|
298
|
-
lines.push(` if [ "$
|
|
299
|
-
lines.push(` git commit -m "release:
|
|
300
|
-
lines.push(`
|
|
301
|
-
lines.push(`
|
|
298
|
+
lines.push(` if [ -n "$TAG_NAMES" ]; then`);
|
|
299
|
+
lines.push(` git commit --allow-empty -m "release: ${modules.map((m) => m.moduleName).join(", ")}"`);
|
|
300
|
+
lines.push(` for TAG_NAME in \${TAG_NAMES}; do`);
|
|
301
|
+
lines.push(` git tag "\${TAG_NAME}"`);
|
|
302
|
+
lines.push(` done`);
|
|
303
|
+
lines.push(` git push origin "HEAD:refs/heads/\${TARGET_BRANCH}" && git push origin --tags"`);
|
|
302
304
|
lines.push(` else`);
|
|
303
305
|
lines.push(` echo "No new tags created; skipping commit/push"`);
|
|
304
306
|
lines.push(` fi`);
|
|
@@ -328,6 +330,7 @@ function appendModulePublishJob(lines, module) {
|
|
|
328
330
|
lines.push(` script:`);
|
|
329
331
|
lines.push(` - cp -r ci $MODULE_PATH/ci`);
|
|
330
332
|
lines.push(` - cd $MODULE_PATH`);
|
|
333
|
+
lines.push(` - cat deploy.env`);
|
|
331
334
|
lines.push(` - source deploy.env`);
|
|
332
335
|
lines.push(` - npm ci`);
|
|
333
336
|
lines.push(` - cp ci/$MODULE_TYPE/Dockerfile .`);
|