support to select xmake/branch and fix links
This commit is contained in:
+12
-1
@@ -3,8 +3,19 @@ import * as semver from 'semver';
|
||||
import { lsRemote } from './git';
|
||||
|
||||
export async function selectVersion(version?: string): Promise<{ version: string; sha: string }> {
|
||||
|
||||
// get version string
|
||||
version = (version ?? core.getInput('xmake-version')) || 'latest';
|
||||
if (version.toLowerCase() === 'latest') version = '';
|
||||
|
||||
// select branch
|
||||
if (version.startsWith('branch@')) {
|
||||
const branch = version.substr(7);
|
||||
core.info(`Selected xmake branch: ${branch}`);
|
||||
return { version: version, sha: branch };
|
||||
}
|
||||
|
||||
// select version
|
||||
version = semver.validRange(version);
|
||||
if (!version) {
|
||||
throw new Error(`Invalid input xmake-version: ${core.getInput('xmake-version')}`);
|
||||
@@ -17,6 +28,6 @@ export async function selectVersion(version?: string): Promise<{ version: string
|
||||
}
|
||||
|
||||
const sha = versions[ver];
|
||||
core.info(`selected xmake v${ver} (commit: ${sha.substr(0, 8)})`);
|
||||
core.info(`Selected xmake v${ver} (commit: ${sha.substr(0, 8)})`);
|
||||
return { version: ver, sha };
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user