Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support ci-friendly versions #33

Open
gdupontf opened this issue Nov 29, 2023 · 5 comments
Open

Support ci-friendly versions #33

gdupontf opened this issue Nov 29, 2023 · 5 comments

Comments

@gdupontf
Copy link

Support for ci-friendly versions would be greatly appreciated.

The way I see it the defaults would be :

  • Injecting the release version into revision
  • Specifying '' (empty string) as changelist
  • Specifying '' (empty string) as buildnumber

With some way of overriding this behaviour for the odd case.

@simonseyock
Copy link
Member

How and where should these values get injected?

@gdupontf
Copy link
Author

Just inject into the revision property along with versions:update-property. For compatibility's sake that should be an alternative toggleable behavior.

There might be value in injecting into the sha1 and changelist properties but targeting revision would be the MVS.

@simonseyock
Copy link
Member

simonseyock commented Jan 18, 2024

We are just using maven to update the version:

async function updateVersion(logger, versionStr, settingsPath, processAllModules, debug) {
logger.log(`Updating pom.xml to version ${versionStr}`);
const processAllModulesOption = processAllModules ? ['-DprocessAllModules'] : [];
const debugOption = debug ? ['-X'] : []
await exec(
'mvn',
[
'versions:set',
...debugOption,
'--batch-mode',
'-DgenerateBackupPoms=false',
'--settings',
settingsPath,
`-DnewVersion=${versionStr}`,
...processAllModulesOption
]
);
}

and also for deployment:

async function deploy(logger, nextVersion, mavenTarget, settingsPath, clean, debug) {
logger.log('Deploying version %s with maven', nextVersion);
const cleanOption = clean ? ['clean'] : [];
const debugOption = debug ? ['-X'] : []
try {
await exec(
'mvn',
[
...cleanOption,
...mavenTarget.split(' '),
...debugOption,
'--batch-mode',
'--no-transfer-progress',
'-DskipTests',
'--settings',
settingsPath
]
);
} catch (e) {
logger.error('failed to deploy to maven');
logger.error(e);
throw new SemanticReleaseError('failed to deploy to maven');
}
}

Can you please provide the exact commands you would use with maven to achieve this? For me it is still unclear where the injected versions should appear - only in the published pom.xml?

@gdupontf
Copy link
Author

A project's version can't be any placeholder property except those 3. Usually in the form of ${revision}${sha1}${changelist}. First two are obvious and changelist is typically either your usual alpha/beta variant and/or a simple -SNAPSHOT placeholder.

Depending on release branch and strategy, you'd have various (but consistent) combinations of these.

@simonseyock
Copy link
Member

I still do not know what command you specifically want to run with versions:update-property. Please provide the exact command you would like to have run.

As stated we run versions:set with the version string provided by semantic release. It is Revision.version from https://github.com/semantic-release/semantic-release/blob/dabdd1d3b3c486026b2e34757d1af5a036f81f5a/index.d.ts#L342C20-L342C29. What else would you want exactly, where would this values come from?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants