Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand Down
28 changes: 27 additions & 1 deletion src/modules/mill.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ export async function install(): Promise<void> {
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}`)

Expand All @@ -46,3 +48,27 @@ export async function install(): Promise<void> {
export async function remove(): Promise<void> {
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
}
}