Skip to content

Commit

Permalink
Fix release CLI tool (#1226)
Browse files Browse the repository at this point in the history
- Adapt script for updating the server version used in the standalone client example
- Update lerna version in releng docker to 7.x
  • Loading branch information
tortmayr authored Feb 2, 2024
1 parent 948f570 commit 193f7f2
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 24 deletions.
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

0 comments on commit 193f7f2

Please sign in to comment.