From 3b69aec09eadb410c69233c440ad64707afaf434 Mon Sep 17 00:00:00 2001 From: Stefania Mellai Date: Thu, 4 Jul 2024 18:09:55 +0200 Subject: [PATCH] chore(ci): improve postVersion script --- repo-scripts/npm-postVersion.ts | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/repo-scripts/npm-postVersion.ts b/repo-scripts/npm-postVersion.ts index cf0ca38..60588df 100644 --- a/repo-scripts/npm-postVersion.ts +++ b/repo-scripts/npm-postVersion.ts @@ -1,7 +1,11 @@ -import childProcess, { execSync } from 'child_process'; +import fs from 'fs'; +import childProcess from 'child_process'; +import { PackageJson } from 'type-fest'; -const branchName = execSync('git rev-parse --abbrev-ref HEAD') - .toString('utf-8') - .trim(); +// TODO - analyze commits and use commit messages to annotate tag? -childProcess.execSync(`git push -u origin ${branchName} --tags `); +const packageJson: PackageJson = JSON.parse( + fs.readFileSync('package.json').toString() +); + +childProcess.execSync(`git push origin v${packageJson.version}`);