File tree Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Expand file tree Collapse file tree 1 file changed +8
-3
lines changed Original file line number Diff line number Diff line change @@ -11,7 +11,8 @@ const minisign = require('./minisign');
1111const MINISIGN_KEY = 'RWSGOq2NVecA2UPNdBUZykf1CCb147pkmdtYxgb3Ti+JO/wCYvhbAb/U' ;
1212
1313// The base URL of the official builds of Zig. This is only used as a fallback, if all mirrors fail.
14- const CANONICAL = 'https://ziglang.org/builds' ;
14+ const CANONICAL_DEV = 'https://ziglang.org/builds' ;
15+ const CANONICAL_RELEASE = 'https://ziglang.org/download' ;
1516
1617// The URL of the mirror list. This should be an ASCII-encoded text file, with one mirror per LF-separated line.
1718const MIRRORS_URL = 'https://ziglang.org/download/community-mirrors.txt' ;
@@ -74,8 +75,12 @@ async function downloadTarball(tarball_filename) {
7475 // continue loop to next mirror
7576 }
7677 }
77- core . info ( `Attempting official: ${ CANONICAL } ` ) ;
78- return await downloadFromMirror ( CANONICAL , tarball_filename ) ;
78+
79+ // As a fallback, attempt ziglang.org.
80+ const zig_version = tarball_filename . match ( / \d + \. \d + \. \d + ( - d e v \. \d + \+ [ 0 - 9 a - f ] + ) ? / ) [ 0 ] ;
81+ const canonical = zig_version . includes ( "-dev" ) ? CANONICAL_DEV : `${ CANONICAL_RELEASE } /${ zig_version } ` ;
82+ core . info ( `Attempting official: ${ canonical } ` ) ;
83+ return await downloadFromMirror ( canonical , tarball_filename ) ;
7984}
8085
8186async function retrieveTarball ( tarball_name , tarball_ext ) {
You can’t perform that action at this time.
0 commit comments