Skip to content

Commit 8d16355

Browse files
committed
fix: make command cross platform
1 parent 2c13bbd commit 8d16355

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

.github/actions/configure-gradle/action.yml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@ runs:
1818
echo Configuring custom Gradle distribution URL with version: $gradleVersion
1919
echo Setting distribution URL to: https://d2pjps8lqszrgq.cloudfront.net/gradle-$gradleVersion-bin.zip
2020
21-
sed -i "/distributionUrl/c\\
21+
# Detect OS and set appropriate sed option
22+
if [[ "$OSTYPE" == "darwin"* ]]; then
23+
SED_OPTS=(-i '') # macOS (BSD sed) requires an empty string after -i
24+
else
25+
SED_OPTS=(-i) # Linux (GNU sed) does not need an empty string
26+
fi
27+
28+
sed -i "${SED_OPTS[@]}" "/distributionUrl/c\\
2229
distributionUrl=https://d2pjps8lqszrgq.cloudfront.net/gradle-$gradleVersion-bin.zip\\
2330
" ./gradle/wrapper/gradle-wrapper.properties

0 commit comments

Comments
 (0)