@@ -25,7 +25,7 @@ async function main(){
25
25
26
26
// Get latest version if requested
27
27
if ( fpmVersion === 'latest' ) {
28
-
28
+
29
29
if ( token === 'none' ) {
30
30
core . setFailed ( 'To fetch the latest fpm version, please supply a github token. Alternatively you can specify the fpm release version manually.' ) ;
31
31
}
@@ -48,48 +48,48 @@ async function main(){
48
48
49
49
console . log ( `This platform is ${ process . platform } ` ) ;
50
50
console . log ( `Fetching fpm from ${ fetchPath } ${ filename } ` ) ;
51
-
51
+
52
52
// Download release
53
53
var fpmPath ;
54
54
try {
55
-
55
+
56
56
fpmPath = await tc . downloadTool ( fetchPath + filename ) ;
57
-
57
+
58
58
} catch ( error ) {
59
-
59
+
60
60
core . setFailed ( `Error while trying to fetch fpm - please check that a version exists at the above release url.` ) ;
61
-
61
+
62
62
}
63
63
64
64
console . log ( fpmPath ) ;
65
65
const downloadDir = path . dirname ( fpmPath ) ;
66
-
66
+
67
67
// Add executable flag on unix
68
68
if ( process . platform === 'linux' || process . platform === 'darwin' ) {
69
-
69
+
70
70
await exec . exec ( 'chmod u+x ' + fpmPath ) ;
71
71
72
72
}
73
73
74
74
// Rename to 'fpm'
75
75
if ( process . platform === 'win32' ) {
76
-
76
+
77
77
await io . mv ( fpmPath , downloadDir + '/' + 'fpm.exe' ) ;
78
78
79
79
} else {
80
-
80
+
81
81
await io . mv ( fpmPath , downloadDir + '/' + 'fpm' ) ;
82
82
83
83
}
84
-
84
+
85
85
// Add to path
86
86
core . addPath ( downloadDir ) ;
87
87
console . log ( `fpm added to path at ${ downloadDir } ` ) ;
88
-
88
+
89
89
} catch ( error ) {
90
90
91
91
core . setFailed ( error . message ) ;
92
-
92
+
93
93
}
94
94
} ;
95
95
@@ -111,7 +111,7 @@ function getFPMFilename(useHaskell,fpmVersion,platform){
111
111
}
112
112
113
113
filename += fpmVersion . replace ( 'v' , '' ) + '-' ;
114
-
114
+
115
115
if ( platform === 'linux' ) {
116
116
117
117
filename += 'linux-x86_64' ;
@@ -137,14 +137,14 @@ function getFPMFilename(useHaskell,fpmVersion,platform){
137
137
// Query github API to find the tag for the latest release
138
138
//
139
139
async function getLatestReleaseVersion ( token ) {
140
-
140
+
141
141
const octokit = github . getOctokit ( token ) ;
142
-
143
- const { data : releases } = await octokit . repos . listReleases ( {
144
- owner :'fortran-lang' ,
145
- repo :'fpm' } ) ;
146
142
147
- return releases [ 0 ] . tag_name ;
143
+ const { data : latest } = await octokit . request ( 'GET /repos/{owner}/{repo}/releases/latest' , {
144
+ owner : 'fortran-lang' ,
145
+ repo : 'fpm' } ) ;
146
+
147
+ return latest . tag_name ;
148
148
149
149
}
150
150
0 commit comments