mirror of
https://github.com/actions/setup-java.git
synced 2025-05-23 02:51:46 +00:00
Switch to mode setting so we can write, read, or both
This commit is contained in:
parent
cec4e33030
commit
62c27dc501
@ -56,9 +56,9 @@ inputs:
|
|||||||
cache:
|
cache:
|
||||||
description: 'Name of the build platform to cache dependencies. It can be "maven" or "gradle".'
|
description: 'Name of the build platform to cache dependencies. It can be "maven" or "gradle".'
|
||||||
required: false
|
required: false
|
||||||
cache-is-read-only:
|
cache-mode:
|
||||||
description: 'Whether or not the build output should be cached. Default is true.'
|
description: 'Whether the cache should be read from pre-build, written to afterwards, or both'
|
||||||
default: true
|
default: both
|
||||||
job-status:
|
job-status:
|
||||||
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
||||||
default: ${{ job.status }}
|
default: ${{ job.status }}
|
||||||
|
@ -23,8 +23,9 @@ async function removePrivateKeyFromKeychain() {
|
|||||||
async function saveCache() {
|
async function saveCache() {
|
||||||
const jobStatus = isJobStatusSuccess();
|
const jobStatus = isJobStatusSuccess();
|
||||||
const cache = core.getInput(constants.INPUT_CACHE);
|
const cache = core.getInput(constants.INPUT_CACHE);
|
||||||
const readOnlyCache = core.getInput(constants.INPUT_CACHE_READ_ONLY)
|
const cacheMode = core.getInput(constants.INPUT_CACHE_MODE)
|
||||||
return jobStatus && cache && !readOnlyCache ? save(cache) : Promise.resolve();
|
const updateCache = Boolean(cacheMode === "both" || cacheMode === "write")
|
||||||
|
return jobStatus && cache && updateCache ? save(cache) : Promise.resolve();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -17,7 +17,7 @@ export const INPUT_DEFAULT_GPG_PRIVATE_KEY = undefined;
|
|||||||
export const INPUT_DEFAULT_GPG_PASSPHRASE = 'GPG_PASSPHRASE';
|
export const INPUT_DEFAULT_GPG_PASSPHRASE = 'GPG_PASSPHRASE';
|
||||||
|
|
||||||
export const INPUT_CACHE = 'cache';
|
export const INPUT_CACHE = 'cache';
|
||||||
export const INPUT_CACHE_READ_ONLY = "cache-is-read-only";
|
export const INPUT_CACHE_MODE = "cache-mode";
|
||||||
export const INPUT_JOB_STATUS = 'job-status';
|
export const INPUT_JOB_STATUS = 'job-status';
|
||||||
|
|
||||||
export const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint';
|
export const STATE_GPG_PRIVATE_KEY_FINGERPRINT = 'gpg-private-key-fingerprint';
|
||||||
|
@ -42,7 +42,9 @@ async function run() {
|
|||||||
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
core.info(`##[add-matcher]${path.join(matchersPath, 'java.json')}`);
|
||||||
|
|
||||||
await auth.configureAuthentication();
|
await auth.configureAuthentication();
|
||||||
if (cache) {
|
const cacheMode = core.getInput(constants.INPUT_CACHE_MODE)
|
||||||
|
const restoreCache = Boolean(cacheMode === "both" || cacheMode === "read")
|
||||||
|
if (cache && restoreCache) {
|
||||||
await restore(cache);
|
await restore(cache);
|
||||||
}
|
}
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Loading…
Reference in New Issue
Block a user