This action enables sbt runner from GitHub Actions.
Here's an example usage of setup-sbt action.
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- uses: actions/checkout@v6
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: sbt
- uses: sbt/setup-sbt@v1
- name: Build and test
shell: bash
run: sbt -v +testuses: sbt/setup-sbt@v1 makes sbt available on Linux, macOS, and Windows.
The sbt runner (Bash script that launches sbt) is typically compatible with all modern sbt releases,
you might want to pin the runner to a specific version.
env:
JAVA_OPTS: -Xms2048M -Xmx2048M -Xss6M -XX:ReservedCodeCacheSize=256M -Dfile.encoding=UTF-8
steps:
- uses: actions/checkout@v6
- name: Setup JDK
uses: actions/setup-java@v5
with:
distribution: temurin
java-version: 17
cache: sbt
- uses: sbt/setup-sbt@v1
with:
sbt-runner-version: 1.9.9
- name: Build and test
shell: bash
run: sbt -v +testThe runner images on GitHub Action had long included sbt runner script. The initial commit on actions/runner-images contains images/linux/scripts/installers/sbt.sh
However, the situation has changed in May 2024 when GitHub released the runner image for macos-13 and macos-14, users noticed that they were missing the sbt runner script.
actions/runner-images#9369 and actions/runner-images#9837 confirmed that this was intentional:
Thank you for such detail request. But currently we have no plans to add
sbtonmacOS-13/macOS-14.
Since GitHub Actions are extensible, we thought this providing a setup action would be convenient way to enable sbt again on all runner images.
The situation changed again in December 2024 when GitHub dropped sbt from ubuntu-latest. So now this same action is needed for Ubuntu-based builds, too.
The scripts and documentation in this project are released under the MIT License.