mirror of
https://github.com/actions/setup-java.git
synced 2025-03-13 09:37:03 +00:00
Switch to mode setting so we can write, read, or both
This commit is contained in:
parent
cec4e33030
commit
62c27dc501
4 changed files with 10 additions and 7 deletions
|
@ -56,9 +56,9 @@ inputs:
|
|||
cache:
|
||||
description: 'Name of the build platform to cache dependencies. It can be "maven" or "gradle".'
|
||||
required: false
|
||||
cache-is-read-only:
|
||||
description: 'Whether or not the build output should be cached. Default is true.'
|
||||
default: true
|
||||
cache-mode:
|
||||
description: 'Whether the cache should be read from pre-build, written to afterwards, or both'
|
||||
default: both
|
||||
job-status:
|
||||
description: 'Workaround to pass job status to post job step. This variable is not intended for manual setting'
|
||||
default: ${{ job.status }}
|
||||
|
|
|
@ -23,8 +23,9 @@ async function removePrivateKeyFromKeychain() {
|
|||
async function saveCache() {
|
||||
const jobStatus = isJobStatusSuccess();
|
||||
const cache = core.getInput(constants.INPUT_CACHE);
|
||||
const readOnlyCache = core.getInput(constants.INPUT_CACHE_READ_ONLY)
|
||||
return jobStatus && cache && !readOnlyCache ? save(cache) : Promise.resolve();
|
||||
const cacheMode = core.getInput(constants.INPUT_CACHE_MODE)
|
||||
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_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 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')}`);
|
||||
|
||||
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);
|
||||
}
|
||||
} catch (error) {
|
||||
|
|
Loading…
Add table
Reference in a new issue