Skip to content

Commit 52cde90

Browse files
authored
Merge pull request #676 from gradle/erichaagdev/add-download-version
Expose option to download latest development release in the download actions
2 parents af352df + 831909b commit 52cde90

File tree

2 files changed

+26
-8
lines changed

2 files changed

+26
-8
lines changed

.github/actions/gradle/download/action.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
token:
66
description: "GitHub token"
77
required: false
8+
downloadDevelopmentRelease:
9+
description: "Downloads the latest development version when 'true'; by default, the latest released version is downloaded"
10+
default: "false"
11+
required: false
812

913
runs:
1014
using: "composite"
@@ -19,12 +23,17 @@ runs:
1923
curlOpts+=(--header 'Authorization: Bearer ${{ inputs.token }}')
2024
fi
2125
22-
# Get the download url of the latest release
23-
downloadUrl=$(curl "${curlOpts[@]}" https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep develocity-gradle)
26+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest"
27+
if [ "${{ inputs.downloadDevelopmentRelease }}" == "true" ]; then
28+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/tags/development-latest"
29+
fi
30+
31+
# Get the download url of the latest development or released version
32+
downloadUrl=$(curl "${curlOpts[@]}" "$releaseUrl" | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep develocity-gradle)
2433
25-
# Download the latest version of the build validation scripts
34+
# Download the scripts
2635
curl "${curlOpts[@]}" --output develocity-gradle-build-validation.zip $downloadUrl
2736
28-
# Unzip the downloaded build validation scripts
37+
# Unzip the downloaded scripts
2938
unzip -q -o develocity-gradle-build-validation.zip
3039
shell: bash

.github/actions/maven/download/action.yml

+13-4
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ inputs:
55
token:
66
description: "GitHub token"
77
required: false
8+
downloadDevelopmentRelease:
9+
description: "Downloads the latest development version when 'true'; by default, the latest released version is downloaded"
10+
default: "false"
11+
required: false
812

913
runs:
1014
using: "composite"
@@ -19,12 +23,17 @@ runs:
1923
curlOpts+=(--header 'Authorization: Bearer ${{ inputs.token }}')
2024
fi
2125
22-
# Get the download url of the latest release
23-
downloadUrl=$(curl "${curlOpts[@]}" https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep develocity-maven)
26+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/latest"
27+
if [ "${{ inputs.downloadDevelopmentRelease }}" == "true" ]; then
28+
releaseUrl="https://api.github.com/repos/gradle/gradle-enterprise-build-validation-scripts/releases/tags/development-latest"
29+
fi
30+
31+
# Get the download url of the latest development or released version
32+
downloadUrl=$(curl "${curlOpts[@]}" "$releaseUrl" | jq -c '.assets[] | select(.content_type == "application/zip")' | jq -r .browser_download_url | grep develocity-maven)
2433
25-
# Download the latest version of the build validation scripts
34+
# Download the scripts
2635
curl "${curlOpts[@]}" --output develocity-maven-build-validation.zip $downloadUrl
2736
28-
# Unzip the downloaded build validation scripts
37+
# Unzip the downloaded scripts
2938
unzip -q -o develocity-maven-build-validation.zip
3039
shell: bash

0 commit comments

Comments
 (0)