Skip to content

Commit

Permalink
fix(release): use releaseconfig name to seperate out changelog creati…
Browse files Browse the repository at this point in the history
…on rather than all

Use an indirection using release config instead of all artifacts to generate changelog
  • Loading branch information
azlam-abdulsalam committed Feb 12, 2024
1 parent fbbd745 commit 533d932
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 8 deletions.
9 changes: 9 additions & 0 deletions packages/sfp-cli/src/impl/artifacts/FetchImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,19 @@ export default class FetchImpl {
for (const releaseDefinition of releaseDefinitions) {
//Each release will be downloaded to specific subfolder inside the provided artifact directory
//As each release is a collection of artifacts

let revisedArtifactDirectory = path.join(
this.artifactDirectory,
releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-')
);
if(releaseDefinition.releaseConfigName)
{
revisedArtifactDirectory = path.join(
this.artifactDirectory,
releaseDefinition.releaseConfigName.replace(/[/\\?%*:|"<>]/g, '-'),
releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-')
);
}

rimraf.sync(revisedArtifactDirectory);
fs.mkdirpSync(revisedArtifactDirectory);
Expand Down
30 changes: 22 additions & 8 deletions packages/sfp-cli/src/impl/release/ReleaseImpl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ type DeploymentStatus = {
result: DeploymentResult;
};


export default class ReleaseImpl {



constructor(private props: ReleaseProps, private logger?: Logger) {}

public async exec(): Promise<ReleaseResult> {
Expand Down Expand Up @@ -118,7 +122,7 @@ export default class ReleaseImpl {
try {
let changelogImpl: ChangelogImpl = new ChangelogImpl(
this.logger,
'artifacts',
this.getArtifactDirectory(releaseDefinition),
releaseName,
workitemFilters,
limit,
Expand Down Expand Up @@ -235,15 +239,10 @@ export default class ReleaseImpl {

this.displayReleaseInfo(releaseDefinition, this.props);

//Each release will be downloaded to specific subfolder inside the provided artifact directory
//As each release is a collection of artifacts
let revisedArtifactDirectory = path.join(
'artifacts',
releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-')
);

let deployProps: DeployProps = {
targetUsername: this.props.targetOrg,
artifactDir: revisedArtifactDirectory,
artifactDir: this.getArtifactDirectory(releaseDefinition),
waitTime: this.props.waitTime,
tags: this.props.tags,
isTestsToBeTriggered: false,
Expand Down Expand Up @@ -407,6 +406,21 @@ export default class ReleaseImpl {

SFPLogger.printHeaderLine('', COLOR_HEADER, LoggerLevel.INFO);
}

private getArtifactDirectory(releaseDefinition: ReleaseDefinition) {
let revisedArtifactDirectory = path.join(
'artifacts',
releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-')
);
if (releaseDefinition.releaseConfigName) {
revisedArtifactDirectory = path.join(
'artifacts',
releaseDefinition.releaseConfigName.replace(/[/\\?%*:|"<>]/g, '-'),
releaseDefinition.release.replace(/[/\\?%*:|"<>]/g, '-')
);
}
return revisedArtifactDirectory;
}
}

interface InstallDependenciesResult {
Expand Down

0 comments on commit 533d932

Please sign in to comment.