File tree Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Expand file tree Collapse file tree 2 files changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -44,6 +44,9 @@ if (!tempDirectory) {
44
44
}
45
45
function getNode ( versionSpec ) {
46
46
return __awaiter ( this , void 0 , void 0 , function * ( ) {
47
+ if ( versionSpec . toLowerCase ( ) === 'lts' ) {
48
+ versionSpec = getLtsVersion ( ) ;
49
+ }
47
50
// check cache
48
51
let toolPath ;
49
52
toolPath = tc . find ( 'node' , versionSpec ) ;
@@ -84,6 +87,19 @@ function getNode(versionSpec) {
84
87
} ) ;
85
88
}
86
89
exports . getNode = getNode ;
90
+ // Schedule based off https://nodejs.org/en/about/releases/. TODO: would be nice to automate this so we don't drift
91
+ function getLtsVersion ( ) {
92
+ const today = new Date ( ) ;
93
+ if ( today < new Date ( 2019 , 9 , 22 ) ) {
94
+ return '10.x' ;
95
+ }
96
+ else if ( today < new Date ( 2020 , 9 , 20 ) ) {
97
+ return '12.x' ;
98
+ }
99
+ else {
100
+ return '14.x' ;
101
+ }
102
+ }
87
103
function queryLatestMatch ( versionSpec ) {
88
104
return __awaiter ( this , void 0 , void 0 , function * ( ) {
89
105
// node offers a json list of versions
Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ interface INodeVersion {
36
36
}
37
37
38
38
export async function getNode ( versionSpec : string ) {
39
+ if ( versionSpec . toLowerCase ( ) === 'lts' ) {
40
+ versionSpec = getLtsVersion ( ) ;
41
+ }
42
+
39
43
// check cache
40
44
let toolPath : string ;
41
45
toolPath = tc . find ( 'node' , versionSpec ) ;
@@ -81,6 +85,18 @@ export async function getNode(versionSpec: string) {
81
85
core . addPath ( toolPath ) ;
82
86
}
83
87
88
+ // Schedule based off https://nodejs.org/en/about/releases/. TODO: would be nice to automate this so we don't drift
89
+ function getLtsVersion ( ) : string {
90
+ const today = new Date ( ) ;
91
+ if ( today < new Date ( 2019 , 9 , 22 ) ) {
92
+ return '10.x' ;
93
+ } else if ( today < new Date ( 2020 , 9 , 20 ) ) {
94
+ return '12.x' ;
95
+ } else {
96
+ return '14.x' ;
97
+ }
98
+ }
99
+
84
100
async function queryLatestMatch ( versionSpec : string ) : Promise < string > {
85
101
// node offers a json list of versions
86
102
let dataFileName : string ;
You can’t perform that action at this time.
0 commit comments