From 496805c15ebc59299b3bc2424073bb1ba7609dfb Mon Sep 17 00:00:00 2001 From: Roberto Tyley Date: Thu, 14 Mar 2024 12:40:14 +0000 Subject: [PATCH] Specify Java 21 using asdf's .tool-versions This is motivated by https://github.com/guardian/gha-scala-library-release-workflow/pull/31 - initially I was just thinking about updating to Java 21, but now I think that making projects declare which Java version they use to build is probably a good thing! Note that we're using asdf's .tool-versions file here, which has recently gained support in https://github.com/actions/setup-java/pull/606 - this means that we can also get _all_ our GitHub Actions files to respect the Java version definied in that file - eg, we can reference it in ci.yml, and we don't need to update Java version in there anymore. --- .github/workflows/ci.yml | 6 +++--- .tool-versions | 1 + 2 files changed, 4 insertions(+), 3 deletions(-) create mode 100644 .tool-versions diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bad3385..b7c8bba 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,12 +14,12 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Setup JDK - uses: actions/setup-java@v3 + uses: actions/setup-java@v4 with: distribution: corretto - java-version: 17 # Currently Java 17 required by `s3mock-testcontainers` + java-version-file: .tool-versions cache: sbt - name: Build and Test run: sbt -v +test diff --git a/.tool-versions b/.tool-versions new file mode 100644 index 0000000..7eb0080 --- /dev/null +++ b/.tool-versions @@ -0,0 +1 @@ +java corretto-21.0.2.13.1