mirror of
https://github.com/gradle/actions
synced 2024-12-17 21:52:21 +00:00
parent
124cb765ee
commit
8cade330d4
5 changed files with 49 additions and 22 deletions
|
@ -55,6 +55,17 @@ jobs:
|
|||
- name: Test use release-candidate
|
||||
working-directory: .github/workflow-samples/no-wrapper
|
||||
run: gradle help
|
||||
- name: Setup Gradle with current
|
||||
id: gradle-current
|
||||
uses: ./
|
||||
with:
|
||||
gradle-version: current
|
||||
- name: Check current version output parameter
|
||||
if: ${{ !startsWith(steps.gradle-current.outputs.gradle-version , '8.') }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.gradle-current.outputs.gradle-version }}"')
|
||||
|
||||
gradle-versions:
|
||||
strategy:
|
||||
|
@ -80,10 +91,17 @@ jobs:
|
|||
distribution: temurin
|
||||
java-version: 8
|
||||
- name: Setup Gradle
|
||||
id: setup-gradle
|
||||
uses: ./
|
||||
with:
|
||||
cache-read-only: false # For testing, allow writing cache entries on non-default branches
|
||||
gradle-version: ${{ matrix.gradle }}
|
||||
- name: Check output parameter
|
||||
if: ${{ steps.setup-gradle.outputs.gradle-version != matrix.gradle }}
|
||||
uses: actions/github-script@v6
|
||||
with:
|
||||
script: |
|
||||
core.setFailed('Gradle version parameter not set correctly: value was "${{ steps.setup-gradle.outputs.gradle-version }}"')
|
||||
- name: Run Gradle build
|
||||
id: gradle
|
||||
working-directory: .github/workflow-samples/no-wrapper${{ matrix.build-root-suffix }}
|
||||
|
|
|
@ -90,6 +90,8 @@ outputs:
|
|||
description: Link to the Build Scan® generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||
dependency-graph-file:
|
||||
description: Path to the GitHub Dependency Graph snapshot file generated by a Gradle build. Note that this output applies to a Step executing Gradle, not to the `gradle-build-action` Step itself.
|
||||
gradle-version:
|
||||
description: Version of Gradle that was setup by the action
|
||||
|
||||
runs:
|
||||
using: 'node16'
|
||||
|
|
20
dist/main/index.js
vendored
20
dist/main/index.js
vendored
|
@ -74827,6 +74827,13 @@ function addToPath(executable) {
|
|||
});
|
||||
}
|
||||
function installGradle(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield resolveGradleVersion(version);
|
||||
core.setOutput('gradle-version', versionInfo.version);
|
||||
return installGradleVersion(versionInfo);
|
||||
});
|
||||
}
|
||||
function resolveGradleVersion(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
switch (version) {
|
||||
case 'current':
|
||||
|
@ -74847,15 +74854,14 @@ function installGradle(version) {
|
|||
}
|
||||
function gradleCurrent() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`);
|
||||
return installGradleVersion(versionInfo);
|
||||
return yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`);
|
||||
});
|
||||
}
|
||||
function gradleReleaseCandidate() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-candidate`);
|
||||
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
|
||||
return installGradleVersion(versionInfo);
|
||||
return versionInfo;
|
||||
}
|
||||
core.info('No current release-candidate found, will fallback to current');
|
||||
return gradleCurrent();
|
||||
|
@ -74863,14 +74869,12 @@ function gradleReleaseCandidate() {
|
|||
}
|
||||
function gradleNightly() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`);
|
||||
return installGradleVersion(versionInfo);
|
||||
return yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`);
|
||||
});
|
||||
}
|
||||
function gradleReleaseNightly() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const versionInfo = yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`);
|
||||
return installGradleVersion(versionInfo);
|
||||
return yield gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`);
|
||||
});
|
||||
}
|
||||
function gradle(version) {
|
||||
|
@ -74879,7 +74883,7 @@ function gradle(version) {
|
|||
if (!versionInfo) {
|
||||
throw new Error(`Gradle version ${version} does not exists`);
|
||||
}
|
||||
return installGradleVersion(versionInfo);
|
||||
return versionInfo;
|
||||
});
|
||||
}
|
||||
function gradleVersionDeclaration(url) {
|
||||
|
|
2
dist/main/index.js.map
vendored
2
dist/main/index.js.map
vendored
File diff suppressed because one or more lines are too long
|
@ -38,6 +38,12 @@ async function addToPath(executable: string): Promise<string> {
|
|||
}
|
||||
|
||||
async function installGradle(version: string): Promise<string> {
|
||||
const versionInfo = await resolveGradleVersion(version)
|
||||
core.setOutput('gradle-version', versionInfo.version)
|
||||
return installGradleVersion(versionInfo)
|
||||
}
|
||||
|
||||
async function resolveGradleVersion(version: string): Promise<GradleVersionInfo> {
|
||||
switch (version) {
|
||||
case 'current':
|
||||
return gradleCurrent()
|
||||
|
@ -55,36 +61,33 @@ async function installGradle(version: string): Promise<string> {
|
|||
}
|
||||
}
|
||||
|
||||
async function gradleCurrent(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`)
|
||||
return installGradleVersion(versionInfo)
|
||||
async function gradleCurrent(): Promise<GradleVersionInfo> {
|
||||
return await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/current`)
|
||||
}
|
||||
|
||||
async function gradleReleaseCandidate(): Promise<string> {
|
||||
async function gradleReleaseCandidate(): Promise<GradleVersionInfo> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-candidate`)
|
||||
if (versionInfo && versionInfo.version && versionInfo.downloadUrl) {
|
||||
return installGradleVersion(versionInfo)
|
||||
return versionInfo
|
||||
}
|
||||
core.info('No current release-candidate found, will fallback to current')
|
||||
return gradleCurrent()
|
||||
}
|
||||
|
||||
async function gradleNightly(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`)
|
||||
return installGradleVersion(versionInfo)
|
||||
async function gradleNightly(): Promise<GradleVersionInfo> {
|
||||
return await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/nightly`)
|
||||
}
|
||||
|
||||
async function gradleReleaseNightly(): Promise<string> {
|
||||
const versionInfo = await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`)
|
||||
return installGradleVersion(versionInfo)
|
||||
async function gradleReleaseNightly(): Promise<GradleVersionInfo> {
|
||||
return await gradleVersionDeclaration(`${gradleVersionsBaseUrl}/release-nightly`)
|
||||
}
|
||||
|
||||
async function gradle(version: string): Promise<string> {
|
||||
async function gradle(version: string): Promise<GradleVersionInfo> {
|
||||
const versionInfo = await findGradleVersionDeclaration(version)
|
||||
if (!versionInfo) {
|
||||
throw new Error(`Gradle version ${version} does not exists`)
|
||||
}
|
||||
return installGradleVersion(versionInfo)
|
||||
return versionInfo
|
||||
}
|
||||
|
||||
async function gradleVersionDeclaration(url: string): Promise<GradleVersionInfo> {
|
||||
|
|
Loading…
Reference in a new issue