@@ -22,8 +22,8 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
22
22
await cacheDistributor . restoreCache ( ) ;
23
23
}
24
24
25
- function resolveVersionInput ( ) : string {
26
- let version = core . getInput ( 'python-version' ) ;
25
+ function resolveVersionInput ( ) : string | string [ ] {
26
+ let version : string | string [ ] = core . getMultilineInput ( 'python-version' ) ;
27
27
let versionFile = core . getInput ( 'python-version-file' ) ;
28
28
29
29
if ( version && versionFile ) {
@@ -32,7 +32,7 @@ function resolveVersionInput(): string {
32
32
) ;
33
33
}
34
34
35
- if ( version ) {
35
+ if ( version . length ) {
36
36
return version ;
37
37
}
38
38
@@ -75,35 +75,43 @@ async function run() {
75
75
`Python is expected to be installed into ${ process . env [ 'RUNNER_TOOL_CACHE' ] } `
76
76
) ;
77
77
try {
78
- const version = resolveVersionInput ( ) ;
78
+ let versions : string [ ] ;
79
+ const resolvedVersionInput = resolveVersionInput ( ) ;
79
80
const checkLatest = core . getBooleanInput ( 'check-latest' ) ;
80
81
81
- if ( version ) {
82
- let pythonVersion : string ;
83
- const arch : string = core . getInput ( 'architecture' ) || os . arch ( ) ;
84
- const updateEnvironment = core . getBooleanInput ( 'update-environment' ) ;
85
- if ( isPyPyVersion ( version ) ) {
86
- const installed = await finderPyPy . findPyPyVersion (
87
- version ,
88
- arch ,
89
- updateEnvironment ,
90
- checkLatest
91
- ) ;
92
- pythonVersion = `${ installed . resolvedPyPyVersion } -${ installed . resolvedPythonVersion } ` ;
93
- core . info (
94
- `Successfully set up PyPy ${ installed . resolvedPyPyVersion } with Python (${ installed . resolvedPythonVersion } )`
95
- ) ;
96
- } else {
97
- const installed = await finder . useCpythonVersion (
98
- version ,
99
- arch ,
100
- updateEnvironment ,
101
- checkLatest
102
- ) ;
103
- pythonVersion = installed . version ;
104
- core . info ( `Successfully set up ${ installed . impl } (${ pythonVersion } )` ) ;
105
- }
82
+ if ( Array . isArray ( resolvedVersionInput ) ) {
83
+ versions = ( resolveVersionInput as unknown ) as string [ ] ;
84
+ } else {
85
+ versions = [ ( resolveVersionInput as unknown ) as string ] ;
86
+ }
106
87
88
+ if ( versions . length ) {
89
+ let pythonVersion = '' ;
90
+ for ( const version of versions ) {
91
+ const arch : string = core . getInput ( 'architecture' ) || os . arch ( ) ;
92
+ const updateEnvironment = core . getBooleanInput ( 'update-environment' ) ;
93
+ if ( isPyPyVersion ( version ) ) {
94
+ const installed = await finderPyPy . findPyPyVersion (
95
+ version ,
96
+ arch ,
97
+ updateEnvironment ,
98
+ checkLatest
99
+ ) ;
100
+ pythonVersion = `${ installed . resolvedPyPyVersion } -${ installed . resolvedPythonVersion } ` ;
101
+ core . info (
102
+ `Successfully set up PyPy ${ installed . resolvedPyPyVersion } with Python (${ installed . resolvedPythonVersion } )`
103
+ ) ;
104
+ } else {
105
+ const installed = await finder . useCpythonVersion (
106
+ version ,
107
+ arch ,
108
+ updateEnvironment ,
109
+ checkLatest
110
+ ) ;
111
+ pythonVersion = installed . version ;
112
+ core . info ( `Successfully set up ${ installed . impl } (${ pythonVersion } )` ) ;
113
+ }
114
+ }
107
115
const cache = core . getInput ( 'cache' ) ;
108
116
if ( cache && isCacheFeatureAvailable ( ) ) {
109
117
await cacheDependencies ( cache , pythonVersion ) ;
0 commit comments