mirror of
https://github.com/actions/setup-python.git
synced 2026-01-21 05:38:54 +08:00
Add linux os release info to primary key
This commit is contained in:
parent
c474c82340
commit
f22ce50675
6 changed files with 137 additions and 18 deletions
18
src/utils.ts
18
src/utils.ts
|
|
@ -3,6 +3,7 @@ import * as core from '@actions/core';
|
|||
import fs from 'fs';
|
||||
import * as path from 'path';
|
||||
import * as semver from 'semver';
|
||||
import * as exec from '@actions/exec';
|
||||
|
||||
export const IS_WINDOWS = process.platform === 'win32';
|
||||
export const IS_LINUX = process.platform === 'linux';
|
||||
|
|
@ -119,3 +120,20 @@ export function isCacheFeatureAvailable(): boolean {
|
|||
|
||||
return true;
|
||||
}
|
||||
|
||||
export async function getLinuxOSReleaseInfo() {
|
||||
const versionId = await exec.getExecOutput('lsb_release', ['-a'], {
|
||||
silent: true
|
||||
});
|
||||
let osVersion = '';
|
||||
let osRelease = '';
|
||||
|
||||
versionId.stdout.split('\n').forEach(elem => {
|
||||
if (elem.includes('Distributor')) osVersion = elem.split(':')[1].trim();
|
||||
if (elem.includes('Release')) osRelease = elem.split(':')[1].trim();
|
||||
});
|
||||
|
||||
core.info(osRelease);
|
||||
core.info(osVersion);
|
||||
return `${osVersion}-${osRelease}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue