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