Skip to content

Commit 3694e72

Browse files
authored
fix: don't use gradle to change gradle distribution URL (#66)
1 parent 5e545cd commit 3694e72

File tree

2 files changed

+19
-5
lines changed

2 files changed

+19
-5
lines changed

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

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,21 @@ runs:
1212
shell: bash
1313
run: |
1414
cd ${{ inputs.working-directory }}
15-
gradleVersion=$(grep "distributionUrl" ./gradle/wrapper/gradle-wrapper.properties | sed -n 's|.*gradle-\([0-9.]*\)-bin.zip|\1|p')
16-
echo Configuring custom Gradle distribution URL with version: $gradleVersion
17-
echo gradle wrapper --gradle-distribution-url https://d2pjps8lqszrgq.cloudfront.net/gradle-$gradleVersion-bin.zip
18-
gradle wrapper --gradle-distribution-url https://d2pjps8lqszrgq.cloudfront.net/gradle-$gradleVersion-bin.zip
15+
16+
GRADLE_VERSION=$(grep "distributionUrl" ./gradle/wrapper/gradle-wrapper.properties | sed -n 's|.*gradle-\([0-9.]*\)-bin.zip|\1|p')
17+
CUSTOM_URL="https://d2pjps8lqszrgq.cloudfront.net/gradle-$GRADLE_VERSION-bin.zip"
18+
19+
echo Configuring custom Gradle distribution URL with version: $GRADLE_VERSION
20+
echo Setting distribution URL to: $CUSTOM_URL
21+
22+
# Detect OS and set appropriate sed option
23+
if sed --version 2>/dev/null | grep -q "GNU sed"; then
24+
SED_CMD="sed -i" # GNU sed (Linux)
25+
else
26+
SED_CMD="sed -i ''" # BSD sed (macOS)
27+
fi
28+
29+
# Replace the line containing "distributionUrl" with the new distributionUrl
30+
$SED_CMD "/distributionUrl/c\\
31+
distributionUrl=$CUSTOM_URL\\
32+
" ./gradle/wrapper/gradle-wrapper.properties
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-bin.zip
3+
distributionUrl=https://services.gradle.org/distributions/gradle-8.12.1-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)