8000 Output `python-versions`, containing all Python versions · actions/setup-python@197e69d · GitHub
[go: up one dir, main page]

Skip to content

Commit 197e69d

Browse files
committed
Output python-versions, containing all Python versions
Closes #606
1 parent 3467d92 commit 197e69d

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

action.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ inputs:
2929
outputs:
3030
python-version:
3131
description: "The installed Python or PyPy version. Useful when given a version range as input."
32+
python-versions:
33+
description: "A comma-separated list of all installed Python implementations and versions. Useful for cache-busting."
3234
cache-hit:
3335
description: "A boolean value to indicate a cache entry was found"
3436
python-path:

dist/setup/index.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69871,13 +69871,15 @@ function run() {
6987169871
const allowPreReleases = core.getBooleanInput('allow-prereleases');
6987269872
if (versions.length) {
6987369873
let pythonVersion = '';
69874+
let pythonVersions = [];
6987469875
const arch = core.getInput('architecture') || os.arch();
6987569876
const updateEnvironment = core.getBooleanInput('update-environment');
6987669877
core.startGroup('Installed versions');
6987769878
for (const version of versions) {
6987869879
if (isPyPyVersion(version)) {
6987969880
const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
6988069881
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
69882+
pythonVersions.push(`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}`);
6988169883
core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
6988269884
}
6988369885
else {
@@ -69886,9 +69888,11 @@ function run() {
6988669888
}
6988769889
const installed = yield finder.useCpythonVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
6988869890
pythonVersion = installed.version;
69891+
pythonVersions.push(installed.version);
6988969892
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
6989069893
}
6989169894
}
69895+
core.setOutput('python-versions', pythonVersions.sort().join(','));
6989269896
core.endGroup();
6989369897
const cache = core.getInput('cache');
6989469898
if (cache && utils_1.isCacheFeatureAvailable()) {

src/setup-python.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,7 @@ async function run() {
9090

9191
if (versions.length) {
9292
let pythonVersion = '';
93+
let pythonVersions: string[] = [];
9394
const arch: string = core.getInput('architecture') || os.arch();
9495
const updateEnvironment = core.getBooleanInput('update-environment');
9596
core.startGroup('Installed versions');
@@ -103,6 +104,9 @@ async function run() {
103104
allowPreReleases
104105
);
105106
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
107+
pythonVersions.push(
108+
`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}`
109+
);
106110
core.info(
107111
`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
108112
);
@@ -120,9 +124,11 @@ async function run() {
120124
allowPreReleases
121125
);
122126
pythonVersion = installed.version;
127+
pythonVersions.push(installed.version);
123128
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
124129
}
125130
}
131+
core.setOutput('python-versions', pythonVersions.sort().join(','));
126132
core.endGroup();
127133
const cache = core.getInput('cache');
128134
if (cache && isCacheFeatureAvailable()) {

0 commit comments

Comments
 (0)
0