Skip to content

Commit 8a071aa

Browse files
authored
Merge pull request #6 from sbt/wip/home
Avoid using the working directory
2 parents 294b8d7 + a863874 commit 8a071aa

File tree

1 file changed

+17
-5
lines changed

1 file changed

+17
-5
lines changed

action.yml

+17-5
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,32 @@ inputs:
88
runs:
99
using: "composite"
1010
steps:
11+
- name: Set up cache paths
12+
id: cache-paths
13+
shell: bash
14+
run: |
15+
if [[ "$RUNNER_OS" == "Windows" ]]; then
16+
echo "setupsbt_path=D:/a/_setupsbt" >> $GITHUB_OUTPUT
17+
elif [[ "$RUNNER_OS" == "macOS" ]]; then
18+
echo "setupsbt_path=/Users/runner/work/_setupsbt" >> $GITHUB_OUTPUT
19+
else
20+
echo "setupsbt_path=/home/runner/work/_setupsbt" >> $GITHUB_OUTPUT
21+
fi
22+
1123
- name: Cache sbt distribution
1224
id: cache-dir
1325
uses: actions/cache@v4
1426
with:
15-
path: setupsbt
27+
path: ${{ steps.cache-paths.outputs.setupsbt_path }}
1628
key: ${{ runner.os }}-sbt-${{ inputs.sbt-runner-version }}
1729

1830
- name: "Install sbt"
1931
shell: bash
2032
if: steps.cache-dir.outputs.cache-hit != 'true'
2133
run: |
22-
mkdir -p setupsbt
23-
curl -sL https://github.com/sbt/sbt/releases/download/v$SBT_RUNNER_VERSION/sbt-$SBT_RUNNER_VERSION.zip > setupsbt/sbt-$SBT_RUNNER_VERSION.zip
24-
pushd setupsbt
34+
mkdir -p "${{ steps.cache-paths.outputs.setupsbt_path }}"
35+
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"
36+
pushd "${{ steps.cache-paths.outputs.setupsbt_path }}"
2537
unzip -o "sbt-$SBT_RUNNER_VERSION.zip"
2638
popd
2739
env:
@@ -30,7 +42,7 @@ runs:
3042
- name: "Setup PATH"
3143
shell: bash
3244
run: |
33-
pushd setupsbt
45+
pushd "${{ steps.cache-paths.outputs.setupsbt_path }}"
3446
ls sbt/bin/sbt
3547
echo "$PWD/sbt/bin" >> "$GITHUB_PATH"
3648
popd

0 commit comments

Comments
 (0)