diff --git a/README.md b/README.md index f5d917f3..216eba88 100644 --- a/README.md +++ b/README.md @@ -253,7 +253,7 @@ When it launches it will send PR to update all the repos selected in step (2.2). # Steward will still respect the version specified in # your repository while updating it. # - # Default: 0.12.5 + # Default: 0.12.16 mill-version: '' # Other Scala Steward arguments not yet supported by diff --git a/action.yml b/action.yml index aaa9a043..7d9b04df 100644 --- a/action.yml +++ b/action.yml @@ -116,7 +116,7 @@ inputs: just affect the global `mill` executable. Scala Steward will still respect the version specified in your repository while updating it. - default: "0.12.5" + default: "0.12.16" required: false other-args: description: | diff --git a/src/modules/mill.ts b/src/modules/mill.ts index 63045351..22642d36 100644 --- a/src/modules/mill.ts +++ b/src/modules/mill.ts @@ -19,7 +19,9 @@ export async function install(): Promise { if (cachedPath) { core.addPath(cachedPath) } else { - const millUrl = `https://github.com/lihaoyi/mill/releases/download/${millVersion}/${millVersion}` + const artifactSuffix = getArtifactSuffix() + const downloadExtension = 'exe' + const millUrl = `https://repo1.maven.org/maven2/com/lihaoyi/mill-dist${artifactSuffix}/${millVersion}/mill-dist${artifactSuffix}-${millVersion}.${downloadExtension}` core.debug(`Attempting to install Mill from ${millUrl}`) @@ -46,3 +48,27 @@ export async function install(): Promise { export async function remove(): Promise { await io.rmRF(path.join(path.join(os.homedir(), 'bin'), 'mill')) } + +function getArtifactSuffix(): string { + const platform = os.platform() // 'linux', 'darwin', 'win32' + const arch = os.arch() // 'x64', 'arm64', etc. + + let suffix = '' + + if (platform === 'linux') { + suffix = arch === 'arm64' + ? '-native-linux-aarch64' + : '-native-linux-amd64' + } else if (platform === 'darwin') { + suffix = arch === 'arm64' + ? '-native-mac-aarch64' + : '-native-mac-amd64' + } + + if (suffix === '') { + core.error('This native mill launcher supports only Linux and macOS.') + throw new Error('Unable to detect Mill artifact suffix') + } else { + return suffix + } +}