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

Fix release CLI tool #1226

Merged
merged 1 commit into from
Feb 2, 2024
Merged
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
10 changes: 2 additions & 8 deletions dev-packages/cli/src/commands/release/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ export interface ReleaseOptions {
export type ReleaseRepository = 'npm' | 'm2' | 'm2&p2' | 'p2';

export interface Component {
type: typeof Component.CLI_CHOICES[number];
type: (typeof Component.CLI_CHOICES)[number];
releaseRepo: ReleaseRepository;
githubRepo: string;
directory: string;
Expand Down Expand Up @@ -114,7 +114,7 @@ export namespace ReleaseType {
export const CLI_CHOICES = ['major', 'minor', 'patch', 'rc', 'custom'] as const;
}

export type ReleaseType = typeof ReleaseType.CLI_CHOICES[number];
export type ReleaseType = (typeof ReleaseType.CLI_CHOICES)[number];

export function checkoutAndCd(options: ReleaseOptions): string {
const ghUrl = options.component.githubRepo;
Expand Down Expand Up @@ -244,12 +244,6 @@ export function updateVersion(...packages: { name: string; version: string }[]):
});
}

export function updateServerConfig(configFile: string, version: string, isSnapShot: boolean): void {
LOGGER.info('Update example server download config');
sh.exec(`jq '.isSnapShot=${isSnapShot}| .version="${version}"' ${configFile} > temp.json`, getShellConfig());
sh.exec(`mv temp.json ${configFile}`, getShellConfig());
}

export function asMvnVersion(version: string): string {
LOGGER.debug(`Convert to maven conform version: ${version}`);
const mavenVersion = version.replace('-', '.');
Expand Down
25 changes: 10 additions & 15 deletions dev-packages/cli/src/commands/release/release-client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,17 @@
* SPDX-License-Identifier: EPL-2.0 OR GPL-2.0 WITH Classpath-exception-2.0
********************************************************************************/
import * as sh from 'shelljs';
import { getShellConfig } from '../../util/command-util';
import { LOGGER } from '../../util/logger';
import {
checkoutAndCd,
commitAndTag,
lernaSetVersion,
publish,
ReleaseOptions,
updateLernaForDryRun,
updateVersion,
yarnInstall
} from './common';
import { checkoutAndCd, commitAndTag, lernaSetVersion, publish, ReleaseOptions, updateLernaForDryRun, yarnInstall } from './common';

let REPO_ROOT: string;

export async function releaseClient(options: ReleaseOptions): Promise<void> {
LOGGER.info('Prepare glsp-client release');
LOGGER.debug('Release options: ', options.version);
REPO_ROOT = checkoutAndCd(options);
updateExternalGLSPDependencies(options.version);
updateDownloadServerScript(options.version);
generateChangeLog();
lernaSetVersion(REPO_ROOT, options.version);
build();
Expand All @@ -43,10 +35,13 @@ export async function releaseClient(options: ReleaseOptions): Promise<void> {
publish(REPO_ROOT, options);
}

function updateExternalGLSPDependencies(version: string): void {
LOGGER.info('Update external GLSP dependencies (workflow example server)');
sh.cd(REPO_ROOT);
updateVersion({ name: '@eclipse-glsp-examples/workflow-server-bundled', version });
async function updateDownloadServerScript(version: string): Promise<void> {
LOGGER.info('Update example server download config');
sh.cd(`${REPO_ROOT}/examples/workflow-standalone/scripts`);
const configFile = 'config.json';
LOGGER.info('Update example server download config');
sh.exec(`jq '.version="${version}"' ${configFile} > temp.json`, getShellConfig());
sh.exec(`mv temp.json ${configFile}`, getShellConfig());
}

function generateChangeLog(): void {
Expand Down
2 changes: 1 addition & 1 deletion releng/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ RUN useradd -m releng
RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | gpg --dearmor -o /usr/share/keyrings/githubcli-archive-keyring.gpg;
RUN echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | tee /etc/apt/sources.list.d/github-cli.list > /dev/null;
RUN apt-get update && apt-get install -y gh jq zsh &&\
npm install -g verdaccio lerna-update-wizard lerna@^4.0.0
npm install -g verdaccio lerna-update-wizard lerna@^7.0.0
RUN chsh -s $(which zsh)
COPY . /glsp-build/
RUN cd /glsp-build && \
Expand Down
Loading