Skip to content

Commit 2d235cd

Browse files
committed
Output python-versions for cache-busting
Closes #606
1 parent 5f2af21 commit 2d235cd

File tree

3 files changed

+14
-0
lines changed

3 files changed

+14
-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: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70208,18 +70208,21 @@ function run() {
7020870208
const allowPreReleases = core.getBooleanInput('allow-prereleases');
7020970209
if (versions.length) {
7021070210
let pythonVersion = '';
70211+
const pythonVersions = [];
7021170212
const arch = core.getInput('architecture') || os.arch();
7021270213
const updateEnvironment = core.getBooleanInput('update-environment');
7021370214
core.startGroup('Installed versions');
7021470215
for (const version of versions) {
7021570216
if (isPyPyVersion(version)) {
7021670217
const installed = yield finderPyPy.findPyPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
7021770218
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
70219+
pythonVersions.push(`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}`);
7021870220
core.info(`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`);
7021970221
}
7022070222
else if (isGraalPyVersion(version)) {
7022170223
const installed = yield finderGraalPy.findGraalPyVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
7022270224
pythonVersion = `${installed}`;
70225+
pythonVersions.push(`graalpy${installed}`);
7022370226
core.info(`Successfully set up GraalPy ${installed}`);
7022470227
}
7022570228
else {
@@ -70228,9 +70231,11 @@ function run() {
7022870231
}
7022970232
const installed = yield finder.useCpythonVersion(version, arch, updateEnvironment, checkLatest, allowPreReleases);
7023070233
pythonVersion = installed.version;
70234+
pythonVersions.push(installed.version);
7023170235
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
7023270236
}
7023370237
}
70238+
core.setOutput('python-versions', pythonVersions.sort().join(','));
7023470239
core.endGroup();
7023570240
const cache = core.getInput('cache');
7023670241
if (cache && utils_1.isCacheFeatureAvailable()) {

src/setup-python.ts

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

9696
if (versions.length) {
9797
let pythonVersion = '';
98+
const pythonVersions: string[] = [];
9899
const arch: string = core.getInput('architecture') || os.arch();
99100
const updateEnvironment = core.getBooleanInput('update-environment');
100101
core.startGroup('Installed versions');
@@ -108,6 +109,9 @@ async function run() {
108109
allowPreReleases
109110
);
110111
pythonVersion = `${installed.resolvedPyPyVersion}-${installed.resolvedPythonVersion}`;
112+
pythonVersions.push(
113+
`${installed.resolvedPythonVersion}-pypy${installed.resolvedPyPyVersion}`
114+
);
111115
core.info(
112116
`Successfully set up PyPy ${installed.resolvedPyPyVersion} with Python (${installed.resolvedPythonVersion})`
113117
);
@@ -120,6 +124,7 @@ async function run() {
120124
allowPreReleases
121125
);
122126
pythonVersion = `${installed}`;
127+
pythonVersions.push(`graalpy${installed}`);
123128
core.info(`Successfully set up GraalPy ${installed}`);
124129
} else {
125130
if (version.startsWith('2')) {
@@ -135,9 +140,11 @@ async function run() {
135140
allowPreReleases
136141
);
137142
pythonVersion = installed.version;
143+
pythonVersions.push(installed.version);
138144
core.info(`Successfully set up ${installed.impl} (${pythonVersion})`);
139145
}
140146
}
147+
core.setOutput('python-versions', pythonVersions.sort().join(','));
141148
core.endGroup();
142149
const cache = core.getInput('cache');
143150
if (cache && isCacheFeatureAvailable()) {

0 commit comments

Comments
 (0)