File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -19,7 +19,8 @@ This will automatically download Zig and install it to `PATH`.
1919
2020You can use `version` to set a Zig version to download. This may be a release (`0.13.0`), a specific nightly
2121build (`0.14.0-dev.2+0884a4341`), the string `master` for the latest nightly build, or the string `latest`
22- for the latest full release. The default is `latest`.
22+ for the latest full release. It can also refer to a [Mach nominated version][mach-nominated], such as
23+ ` 2024.5.0-mach` . The default is `latest`.
2324
2425` ` ` yaml
2526 - uses: mlugg/setup-zig@v1
@@ -44,6 +45,8 @@ be https://ziglang.org/download to avoid the oggicial websote being hit with lar
4445If you've experienced issues with a default mirror, please open an issue, and I will communicate with the
4546mirror's owner or remove it from the list.
4647
48+ [mach-nominated] : https://machengine.org/about/nominated-zig/
49+
4750# # Details
4851
4952This action attempts to download the requested Zig tarball from a set of mirrors, in a random order. As
Original file line number Diff line number Diff line change @@ -5,6 +5,7 @@ const github = require('@actions/github');
55const exec = require ( '@actions/exec' ) ;
66
77const VERSIONS_JSON = 'https://ziglang.org/download/index.json' ;
8+ const MACH_VERSIONS_JSON = 'https://pkg.machengine.org/zig/index.json' ;
89const CACHE_PREFIX = "setup-zig-global-cache-" ;
910
1011let _cached_version = null ;
@@ -49,6 +50,13 @@ async function getVersion() {
4950 }
5051 }
5152 _cached_version = latest ;
53+ } else if ( raw . includes ( "mach" ) ) {
54+ const resp = await fetch ( MACH_VERSIONS_JSON ) ;
55+ const versions = await resp . json ( ) ;
56+ if ( ! ( raw in versions ) ) {
57+ throw new Error ( `Mach nominated version '${ raw } ' not found` ) ;
58+ }
59+ _cached_version = versions [ raw ] . version ;
5260 } else {
5361 _cached_version = raw ;
5462 }
You can’t perform that action at this time.
0 commit comments