Skip to content
Merged
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: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,5 @@ Thumbs.db
# Ignore built ts files
__tests__/runner/*
lib/**/*

.idea
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ A GitHub Action to install Scala CLI.

## Inputs

- `scala-cli-version` (optional): scala-cli version to install
- "latest" to install the latest version.
- `jvm` (optional): JVM to install
- one of the options from `cs java --available`.
- if left empty either the existing JVM will be used or Coursier will install its default JVM.
Expand Down
3 changes: 3 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ branding:
icon: 'anchor'
color: 'green'
inputs:
scala-cli-version:
description: 'Version of scala-cli to install ("latest" to install the latest version)'
required: false
jvm:
description: 'JVM to install (leave empty to use default)'
required: false
Expand Down
17 changes: 15 additions & 2 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

15 changes: 13 additions & 2 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,24 @@ async function run(): Promise<void> {

await core.group('Install Apps', async () => {
const apps: string[] = core.getInput('apps').split(' ')
apps.push(`scala-cli:${scalaCLIVersion}`)
const scalaCLIVersionInput = core.getInput('scala-cli-version')
let version
if (scalaCLIVersionInput) {
if (scalaCLIVersionInput === 'latest') {
version = ''
} else {
version = scalaCLIVersionInput
}
} else {
version = scalaCLIVersion
}
apps.push(`scala-cli${version ? `:${version}` : ''}`)
if (apps.length) {
const coursierBinDir = path.join(os.homedir(), 'cs', 'bin')
core.exportVariable('COURSIER_BIN_DIR', coursierBinDir)
core.addPath(coursierBinDir)
await cs('install', '--contrib', ...apps)
core.setOutput('scala-cli-version', scalaCLIVersion)
core.setOutput('scala-cli-version', await execOutput('scala-cli', 'version'))
}
})
} catch (error: any) {
Expand Down