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

Add an epilogue to all README files #986

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 22 additions & 4 deletions modules/builder/builder.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ import SwaggerDiff from '../swagger/swaggerDiff';
import GitModule from '../git/gitModule';
import Zip from '../util/zip';
import { Models } from 'purecloud-platform-client-v2';
import { PassThrough } from 'stream';


const log = new Logger();
Expand All @@ -43,6 +44,7 @@ export class Builder {
pureCloud: PureCloud;
releaseNoteTemplatePath: string = '';
releaseNoteSummaryTemplatePath: string = '';
readmeDevelopmentEpiloguePath: string = '';

init(configPath: string, localConfigPath: string): Promise<string> {
return new Promise<string>((resolve, reject) => {
Expand Down Expand Up @@ -178,6 +180,10 @@ export class Builder {
? this.config.settings.releaseNoteSummaryTemplatePath
: './resources/templates/releaseNoteSummary.md';

this.readmeDevelopmentEpiloguePath = this.config.settings.readmeDevelopmentEpiloguePath
? this.config.settings.readmeDevelopmentEpiloguePath
: path.join(getEnv('COMMON_ROOT') as string, 'resources', 'templates', 'readmeDevelopmentEpilogue.md');

// Initialize other things
git.authToken = getEnv('GITHUB_TOKEN') as string;
resolve("");
Expand Down Expand Up @@ -294,7 +300,7 @@ function prebuildImpl(): Promise<string> {
);
})
.then(() => {
// For Jenkins only.
// For Jenkins only.
if (newSwaggerTempFile.includes('build-platform-sdks-internal-pipeline') && process.argv.includes("build-contains-upstream-changes")) {
if (swaggerDiff.changeCount == 0) {
throw new Error('The build contains upstream changes, but the Swagger definition has not changed.');
Expand Down Expand Up @@ -477,9 +483,21 @@ function buildImpl(): Promise<string> {
// Copy readme from build to docs and repo root
log.info('Copying readme...');
fs.ensureDirSync(path.join(getEnv('SDK_REPO') as string, 'build/docs'));
fs.createReadStream(path.join(getEnv('SDK_REPO') as string, 'build/README.md')).pipe(
fs.createWriteStream(path.join(getEnv('SDK_REPO') as string, 'build/docs/index.md'))
);

// Appends an epilogue to all Readme files
const readmeFileStream = fs.createReadStream(path.join(getEnv('SDK_REPO') as string, 'build/README.md'));
const readmeFileEpilogueStream = fs.createReadStream(_this.readmeDevelopmentEpiloguePath);
const passThroughStream = new PassThrough();
readmeFileStream.pipe(passThroughStream, { end: false });
readmeFileStream.on('end', () => {
readmeFileEpilogueStream.pipe(passThroughStream, { end: false });
readmeFileEpilogueStream.on('end', () => {
passThroughStream.end();
});
});
passThroughStream.pipe(fs.createWriteStream(path.join(getEnv('SDK_REPO') as string, 'build/docs/index.md')));

// Copy the readme file from build to the root directory of the repo
fs.createReadStream(path.join(getEnv('SDK_REPO') as string, 'build/README.md')).pipe(
fs.createWriteStream(path.join(getEnv('SDK_REPO') as string, 'README.md'))
);
Expand Down
1 change: 1 addition & 0 deletions modules/types/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export interface Settings {
enableLoggerColor: boolean;
namespace: string;
apiHealthCheckUrl: string;
readmeDevelopmentEpiloguePath: string;
}

export interface ResourcePaths {
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/clisdkclient/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"mavenSettingsFilePath": "/var/build/settings.xml",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/pureclouddotnet-guest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"namespace": "${DOTNET_NAMESPACE}",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/pureclouddotnet/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"namespace": "${DOTNET_NAMESPACE}",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudgo/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"mavenSettingsFilePath": "/var/build/settings.xml",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudios/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"packageName": "PureCloudPlatformClientV2",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudjava-guest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": true,
"mavenSettingsFilePath": "/var/build/settings.xml",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudjava/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"mavenSettingsFilePath": "/var/build/settings.xml",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudjavascript-guest/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"packageName": "purecloud-guest-chat-client",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudjavascript/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"packageName": "purecloud-platform-client-v2",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudkotlin/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"apiHealthCheckUrl": "https://api.mypurecloud.com/api/v2/health/check"
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/purecloudpython/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"packageName": "PureCloudPlatformClientV2",
Expand Down
1 change: 1 addition & 0 deletions resources/sdk/webmessagingjava/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
},
"releaseNoteTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNotes.md",
"releaseNoteSummaryTemplatePath": "${COMMON_ROOT}/resources/templates/githubSdkReleaseNoteSummary.md",
"readmeDevelopmentEpiloguePath": "${COMMON_ROOT}/resources/templates/readmeDevelopmentEpilogue.md",
"debugConfig": false,
"enableLoggerColor": false,
"mavenSettingsFilePath": "/var/build/settings.xml",
Expand Down
12 changes: 12 additions & 0 deletions resources/templates/readmeDevelopmentEpilogue.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@

## Development and Contributing

⚠️ **Important Notice** ⚠️

This repository is automatically generated. Do not submit pull requests or make changes directly to this repository. Instead, please direct all contributions to the [Platform API Client SDK Common Repository](https://github.com/purecloudlabs/platform-client-sdk-common/).

This is where all changes are managed and propagated to the individual SDK repositories.

Any pull requests made directly to this repository will be closed.

Thank you for your interest in contributing!