@@ -22,8 +22,8 @@ async function cacheDependencies(cache: string, pythonVersion: string) {
2222 await cacheDistributor . restoreCache ( ) ;
2323}
2424
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' ) ;
2727 let versionFile = core . getInput ( 'python-version-file' ) ;
2828
2929 if ( version && versionFile ) {
@@ -32,7 +32,7 @@ function resolveVersionInput(): string {
3232 ) ;
3333 }
3434
35- if ( version ) {
35+ if ( version . length ) {
3636 return version ;
3737 }
3838
@@ -75,35 +75,43 @@ async function run() {
7575 `Python is expected to be installed into ${ process . env [ 'RUNNER_TOOL_CACHE' ] } `
7676 ) ;
7777 try {
78- const version = resolveVersionInput ( ) ;
78+ let versions : string [ ] ;
79+ const resolvedVersionInput = resolveVersionInput ( ) ;
7980 const checkLatest = core . getBooleanInput ( 'check-latest' ) ;
8081
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+ }
10687
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+ }
107115 const cache = core . getInput ( 'cache' ) ;
108116 if ( cache && isCacheFeatureAvailable ( ) ) {
109117 await cacheDependencies ( cache , pythonVersion ) ;
0 commit comments