Skip to content

Commit 845a5b9

Browse files
authored
Merge pull request #33 from jsoref/action-cleanup
Clean up action
2 parents 20811ef + 35fbbc6 commit 845a5b9

File tree

1 file changed

+19
-11
lines changed

1 file changed

+19
-11
lines changed

action.yml

+19-11
Original file line numberDiff line numberDiff line change
@@ -11,17 +11,23 @@ runs:
1111
- name: Set up cache paths
1212
id: cache-paths
1313
shell: bash
14+
env:
15+
SBT_RUNNER_VERSION: ${{ inputs.sbt-runner-version }}
16+
SBT_CACHE_KEY_VERSION: 1.1.4
1417
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"
1619
echo "sbt_downloadpath=$RUNNER_TEMP/_sbt" >> "$GITHUB_OUTPUT"
20+
echo "sbt_cachekey=$RUNNER_OS-sbt-$SBT_RUNNER_VERSION-$SBT_CACHE_KEY_VERSION" >> "$GITHUB_OUTPUT"
1721
- name: Check Tool Cache
1822
id: cache-tool-dir
1923
shell: bash
24+
env:
25+
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
2026
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
2328
echo "cache-hit=true" >> "$GITHUB_OUTPUT"
2429
else
30+
mkdir -p "$SBT_TOOLPATH"
2531
echo "cache-hit=false" >> "$GITHUB_OUTPUT"
2632
fi
2733
- name: Cache sbt distribution
@@ -30,24 +36,26 @@ runs:
3036
uses: actions/cache@v4
3137
with:
3238
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 }}
3440
- name: "Download and Install sbt"
3541
shell: bash
3642
env:
3743
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 }}"
3846
if: steps.cache-tool-dir.outputs.cache-hit != 'true' && steps.cache-dir.outputs.cache-hit != 'true'
3947
run: |
40-
mkdir -p "${{ steps.cache-paths.outputs.sbt_downloadpath }}"
48+
mkdir -p "$SBT_DOWNLOADPATH"
4149
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"
4351
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"
4754
- name: "Setup PATH"
4855
shell: bash
56+
env:
57+
SBT_TOOLPATH: "${{ steps.cache-paths.outputs.sbt_toolpath }}"
4958
run: |
50-
pushd "${{ steps.cache-paths.outputs.sbt_toolpath }}"
59+
cd "$SBT_TOOLPATH"
5160
ls sbt/bin/sbt
5261
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"
53-
popd

0 commit comments

Comments
 (0)