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
4 changes: 3 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macOS-latest, windows-latest]
os: [ubuntu-latest, macOS-latest, macOS-m1, windows-latest]
jvm: ['temurin:17']
steps:
- uses: actions/checkout@v4
Expand All @@ -31,6 +31,8 @@ jobs:
- run: echo 'name := "foo"' > build.sbt
- id: scala-cli-setup
uses: ./
env:
COURSIER_BIN_DIR: ${{ github.workspace }}/cs/bin
with:
jvm: ${{ matrix.jvm }}
apps: sbt sbtn ammonite bloop:1.4.11
Expand Down
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,18 @@ A GitHub Action to install Scala CLI.
option, like publishing.
- Defaults to `false`

### Environment variables
- `JAVA_HOME`: path to the JVM to use
- `COURSIER_BIN_DIR`: (optional) path to the directory where Coursier will install app binaries
- defaults to `$HOME/cs/bin`
- shouldn't have to be tampered with for vanilla GitHub action runners
- make sure the directory is reachable for self-hosted runners
- in case of issues, you can set it to something like
```yaml
env:
COURSIER_BIN_DIR: ${{ github.workspace }}/cs/bin
```

### Example with custom inputs

```yml
Expand Down
14 changes: 11 additions & 3 deletions src/main.ts
Original file line number Diff line number Diff line change
Expand Up @@ -139,9 +139,17 @@ async function run(): Promise<void> {
}
apps.push(`scala-cli${version ? `:${version}` : ''}`)
if (value && apps.length) {
const coursierBinDir = path.join(os.homedir(), 'cs', 'bin')
core.exportVariable('COURSIER_BIN_DIR', coursierBinDir)
core.addPath(coursierBinDir)
if (process.env.COURSIER_BIN_DIR) {
core.info(
`Using the cs bin directory from COURSIER_BIN_DIR: ${process.env.COURSIER_BIN_DIR}`,
)
core.addPath(process.env.COURSIER_BIN_DIR)
} else {
const coursierBinDir = path.join(os.homedir(), 'cs', 'bin')
core.info(`Setting COURSIER_BIN_DIR to: ${coursierBinDir}`)
core.exportVariable('COURSIER_BIN_DIR', coursierBinDir)
core.addPath(coursierBinDir)
}
await cs('install', '--contrib', ...apps)
core.setOutput(
'scala-cli-version',
Expand Down