@@ -7,36 +7,52 @@ inputs:
7
7
default : 1.10.2
8
8
runs :
9
9
using : " composite"
10
+
10
11
steps :
11
12
- name : Set up cache paths
12
13
id : cache-paths
13
14
shell : bash
14
15
run : |
15
- echo "setupsbt_path=$HOME/work/_setupsbt" >> $GITHUB_OUTPUT
16
+ echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/${{ inputs.sbt-runner-version }}" >> "$GITHUB_OUTPUT"
17
+ echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT"
18
+
19
+ - name : Check Tool Cache
20
+ id : cache-tool-dir
21
+ shell : bash
22
+ run : |
23
+ mkdir -p "${{ steps.cache-paths.outputs.sbt_toolpath }}"
24
+ if [ -f "${{ steps.cache-paths.outputs.sbt_toolpath }}/sbt/bin/sbt" ]; then
25
+ echo "cache-hit=true" >> "$GITHUB_OUTPUT"
26
+ else
27
+ echo "cache-hit=false" >> "$GITHUB_OUTPUT"
28
+ fi
16
29
17
30
- name : Cache sbt distribution
18
31
id : cache-dir
32
+ if : steps.cache-tool-dir.outputs.cache-hit != 'true'
19
33
uses : actions/cache@v4
20
34
with :
21
- path : ${{ steps.cache-paths.outputs.setupsbt_path }}
22
- key : ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }}-1.1.1
35
+ path : ${{ steps.cache-paths.outputs.sbt_toolpath }}
36
+ key : ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }}-1.1.4
23
37
24
- - name : " Install sbt"
38
+ - name : " Download and Install sbt"
25
39
shell : bash
26
- if : steps.cache-dir.outputs.cache-hit != 'true'
27
- run : |
28
- mkdir -p "${{ steps.cache-paths.outputs.setupsbt_path }}"
29
- curl -sL https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip > "${{ steps.cache-paths.outputs.setupsbt_path }}/sbt-$SBT_RUNNER_VERSION.zip"
30
- pushd "${{ steps.cache-paths.outputs.setupsbt_path }}"
31
- unzip -o "sbt-$SBT_RUNNER_VERSION.zip"
32
- popd
33
40
env :
34
41
SBT_RUNNER_VERSION : ${{ inputs.sbt-runner-version }}
42
+ if : steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
43
+ run : |
44
+ mkdir -p "${{ steps.cache-paths.outputs.sbt_downloadpath }}"
45
+ curl -sL "https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip" > \
46
+ "${{ steps.cache-paths.outputs.sbt_downloadpath }}/sbt-$SBT_RUNNER_VERSION.zip"
47
+
48
+ pushd "${{ steps.cache-paths.outputs.sbt_downloadpath }}"
49
+ unzip -o "sbt-${{ inputs.sbt-runner-version }}.zip" -d "${{ steps.cache-paths.outputs.sbt_toolpath }}"
50
+ popd
35
51
36
52
- name : " Setup PATH"
37
53
shell : bash
38
54
run : |
39
- pushd "${{ steps.cache-paths.outputs.setupsbt_path }}"
55
+ pushd "${{ steps.cache-paths.outputs.sbt_toolpath }}"
40
56
ls sbt/bin/sbt
41
57
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"
42
58
popd
0 commit comments