-
Notifications
You must be signed in to change notification settings - Fork 7
/
action.yml
61 lines (60 loc) · 2.28 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: "Setup sbt installer"
description: "Sets up sbt runner script"
inputs:
sbt-runner-version:
description: "The runner version (The actual version is controlled via project/build.properties)"
required: true
default: 1.10.6
runs:
using: "composite"
steps:
- name: Set up cache paths
id: cache-paths
shell: bash
env:
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }}
SBT_CACHE_KEY_VERSION: 1.1.4
run: |
echo "sbt_toolpath=$RUNNER_TOOL_CACHE/sbt/$SBT_RUNNER_VERSION" >> "$GITHUB_OUTPUT"
echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT"
echo "sbt_cachekey=$RUNNER_OS-sbt-$SBT_RUNNER_VERSION-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT"
- name: Check Tool Cache
id: cache-tool-dir
shell: bash
env:
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
run: |
if [ -f "$SBT_TOOLPATH/sbt/bin/sbt" ]; then
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
else
mkdir -p "$SBT_TOOLPATH"
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
fi
- name: Cache sbt distribution
id: cache-dir
if: steps.cache-tool-dir.outputs.cache-hit != 'true'
uses: actions/cache@v4
with:
path: ${{ steps.cache-paths.outputs.sbt_toolpath }}
key: ${{ steps.cache-paths.outputs.sbt_cachekey }}
- name: "Download and Install sbt"
shell: bash
env:
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }}
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
SBT_DOWNLOADPATH: "${{ steps.cache-paths.outputs.sbt_downloadpath }}"
if: steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
run: |
mkdir -p "$SBT_DOWNLOADPATH"
curl -sL "https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip" > \
"$SBT_DOWNLOADPATH/sbt-$SBT_RUNNER_VERSION.zip"
cd "$SBT_DOWNLOADPATH"
unzip -o "sbt-$SBT_RUNNER_VERSION.zip" -d "$SBT_TOOLPATH"
- name: "Setup PATH"
shell: bash
env:
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
run: |
cd "$SBT_TOOLPATH"
ls sbt/bin/sbt
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"