Skip to content

Commit

Permalink
add logs + push
Browse files Browse the repository at this point in the history
  • Loading branch information
marikaner committed Sep 10, 2024
1 parent 52c27b7 commit 8de32f0
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion build-packages/changesets-fixed-version-bump/index.ts
Original file line number Diff line number Diff line change
@@ -1,25 +1,31 @@
/* eslint-disable jsdoc/require-jsdoc */
import { resolve } from 'path';
import { formatJson } from '@sap-cloud-sdk/util';
import { getInput, error } from '@actions/core';
import { getInput, error, info } from '@actions/core';
import { command } from 'execa';
import { add, commit, tag } from '@changesets/git';
import { transformFile, getNextVersion } from './util';

async function bump() {
// before bump
info('Bumping version...');
const version = await getNextVersion();
info(`Bumping to version ${version}`);
process.env.NEXT_PACKAGE_VERSION = version;
const beforeBumpScript = getInput('before-bump');
info(`executing before script`);
if (beforeBumpScript) {
command(beforeBumpScript);
}

info(`updating root package.json`);
await updateRootPackageJson(version);
// TODO: what if I use pnpm? either pass the command or package manager?
info(`setting version`);
command('yarn changeset version');

// after bump
info(`executing after script`);
const afterBumpScript = getInput('after-bump');
if (afterBumpScript) {
command(afterBumpScript);
Expand All @@ -42,9 +48,14 @@ async function updateRootPackageJson(version: string) {
async function commitAndTag(version: string) {
const cwd = process.cwd();

info(`add`);
await add('-A', cwd);
info(`commit`);
await commit(`v${version}`, cwd);
info(`tag`);
await tag(`v${version}`, cwd);
info(`push`);
await command('git push'); // --follow-tags');
}

bump();

0 comments on commit 8de32f0

Please sign in to comment.