@@ -34,7 +34,7 @@ Deno.remove(dropExtension(rclone), {recursive: true});
34
34
35
35
console . log ( "All dependencies fetched!" ) ;
36
36
37
- async function releaseUrl ( org : string , repo : string , suffix : string ) : Promise < string > {
37
+ async function releaseUrl ( org : string , repo : string , suffix ? : string ) : Promise < string > {
38
38
let info = await releaseInfo ( org , repo ) ;
39
39
const tag = info . tag_name . match ( / ( [ ^ 0 - 9 ] + ) ( .+ ) / ) ;
40
40
if ( ! tag ) {
@@ -46,14 +46,19 @@ async function releaseUrl(org: string, repo: string, suffix: string): Promise<st
46
46
if ( version != tag [ 2 ] )
47
47
info = await releaseInfo ( org , repo , tag [ 1 ] + version ) ;
48
48
49
- const file = info . assets . find ( function ( each ) {
50
- return each . name . endsWith ( suffix ) ;
51
- } ) ;
52
- if ( ! file ) {
53
- console . error ( "Release " + version + " of " + repo + " not available for Linux!" ) ;
54
- Deno . exit ( 3 ) ;
55
- }
56
- return file . browser_download_url ;
49
+ if ( suffix ) {
50
+ // Download binary release.
51
+ const file = info . assets . find ( function ( each ) {
52
+ return each . name . endsWith ( suffix ) ;
53
+ } ) ;
54
+ if ( ! file ) {
55
+ console . error ( "Release " + info . tag_name + " of " + repo + " not available for Linux!" ) ;
56
+ Deno . exit ( 3 ) ;
57
+ }
58
+ return file . browser_download_url ;
59
+ } else
60
+ // Download source release.
61
+ return "https://github.com/" + org + "/" + repo + "/archive/refs/tags/v" + version + ".tar.gz" ;
57
62
}
58
63
59
64
async function releaseInfo ( org : string , repo : string , tag = "" ) : Promise < ReleaseInfo > {
0 commit comments