Skip to content

Commit

Permalink
ci: Fix apps-engine version showing as undefined (#34108)
Browse files Browse the repository at this point in the history
  • Loading branch information
KevLehman authored Dec 6, 2024
1 parent 5467f06 commit 9684ab2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 9 deletions.
11 changes: 3 additions & 8 deletions packages/release-action/src/getMetadata.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import { readFile } from 'fs/promises';
import path from 'path';

import { getExecOutput } from '@actions/exec';

import { readPackageJson } from './utils';

export async function getMongoVersion(cwd: string) {
Expand All @@ -27,14 +25,11 @@ export async function getNodeNpmVersions(cwd: string): Promise<{ node: string; y
return packageJson.engines;
}

export async function getAppsEngineVersion() {
export async function getAppsEngineVersion(cwd: string) {
try {
const result = await getExecOutput('yarn why @rocket.chat/apps-engine --json');
const result = await readPackageJson(path.join(cwd, 'packages/apps-engine'));

const match = result.stdout.match(/"@rocket\.chat\/meteor@workspace:apps\/meteor".*"@rocket\.chat\/apps\-engine@[^#]+#npm:([^"]+)"/);
if (match) {
return match[1];
}
return result.version ?? 'Not Available';
} catch (e) {
console.error(e);
}
Expand Down
2 changes: 1 addition & 1 deletion packages/release-action/src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ Bump ${pkgName} version.

export async function getEngineVersionsMd(cwd: string) {
const { node } = await getNodeNpmVersions(cwd);
const appsEngine = await getAppsEngineVersion();
const appsEngine = await getAppsEngineVersion(cwd);
const mongo = await getMongoVersion(cwd);

return `### Engine versions
Expand Down

0 comments on commit 9684ab2

Please sign in to comment.