@@ -5,23 +5,39 @@ inputs:
5
5
description : " The runner version (The actual version is controlled via project/build.properties)"
6
6
required : true
7
7
default : 1.10.6
8
+ outputs :
9
+ sbt-toolpath :
10
+ description : " Where sbt tools live"
11
+ value : ${{ steps.cache-paths.outputs.sbt_toolpath }}
12
+ cache-hit :
13
+ description : " If sbt was found in the tool cache or the action/cache"
14
+ value : ${{ steps.cache-tool-dir.outputs.cache-hit == 'true' || steps.cache-dir.outputs.cache-hit == 'true' }}
15
+ cache-key :
16
+ description : " The cache-key for the sbt version (unless sbt was found in the tool cache)"
17
+ value : ${{ steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-paths.outputs.sbt_cachekey || '' }}
8
18
runs :
9
19
using : " composite"
10
20
steps :
11
21
- name : Set up cache paths
12
22
id : cache-paths
13
23
shell : bash
24
+ env :
25
+ SBT_RUNNER_VERSION : ${{ inputs.sbt-runner-version }}
26
+ SBT_CACHE_KEY_VERSION : 1.1.4
14
27
run : |
15
- echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/${{ inputs.sbt-runner-version }} " >> "$GITHUB_OUTPUT"
28
+ echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/$SBT_RUNNER_VERSION " >> "$GITHUB_OUTPUT"
16
29
echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT"
30
+ echo "sbt_cachekey=$RUNNER_OS-sbt-$SBT_RUNNER_VERSION-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT"
17
31
- name : Check Tool Cache
18
32
id : cache-tool-dir
19
33
shell : bash
34
+ env :
35
+ SBT_TOOLPATH : " ${{ steps.cache-paths.outputs.sbt_toolpath }}"
20
36
run : |
21
- mkdir -p "${{ steps.cache-paths.outputs.sbt_toolpath }}"
22
- if [ -f "${{ steps.cache-paths.outputs.sbt_toolpath }}/sbt/bin/sbt" ]; then
37
+ if [ -f "$SBT_TOOLPATH/sbt/bin/sbt" ]; then
23
38
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
24
39
else
40
+ mkdir -p "$SBT_TOOLPATH"
25
41
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
26
42
fi
27
43
- name : Cache sbt distribution
@@ -30,24 +46,26 @@ runs:
30
46
uses : actions/cache@v4
31
47
with :
32
48
path : ${{ steps.cache-paths.outputs.sbt_toolpath }}
33
- key : ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }}-1.1.4
49
+ key : ${{ steps.cache-paths.outputs.sbt_cachekey }}
34
50
- name : " Download and Install sbt"
35
51
shell : bash
36
52
env :
37
53
SBT_RUNNER_VERSION : ${{ inputs.sbt-runner-version }}
54
+ SBT_TOOLPATH : " ${{ steps.cache-paths.outputs.sbt_toolpath }}"
55
+ SBT_DOWNLOADPATH : " ${{ steps.cache-paths.outputs.sbt_downloadpath }}"
38
56
if : steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
39
57
run : |
40
- mkdir -p "${{ steps.cache-paths.outputs.sbt_downloadpath }} "
58
+ mkdir -p "$SBT_DOWNLOADPATH "
41
59
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"
60
+ "$SBT_DOWNLOADPATH /sbt-$SBT_RUNNER_VERSION.zip"
43
61
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
62
+ cd "$SBT_DOWNLOADPATH"
63
+ unzip -o "sbt-$SBT_RUNNER_VERSION.zip" -d "$SBT_TOOLPATH"
47
64
- name : " Setup PATH"
48
65
shell : bash
66
+ env :
67
+ SBT_TOOLPATH : " ${{ steps.cache-paths.outputs.sbt_toolpath }}"
49
68
run : |
50
- pushd "${{ steps.cache-paths.outputs.sbt_toolpath }} "
69
+ cd "$SBT_TOOLPATH "
51
70
ls sbt/bin/sbt
52
71
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"
53
- popd
0 commit comments