Cache wrapper dist, step 1

This commit is contained in:
Paul Merlin 2020-06-13 14:48:54 +02:00
parent 8e2fd532f1
commit 42e2fed267
5 changed files with 18 additions and 2 deletions

2
dist/main/index.js vendored

File diff suppressed because one or more lines are too long

2
dist/post/index.js vendored

File diff suppressed because one or more lines are too long

11
src/cache.ts Normal file
View file

@ -0,0 +1,11 @@
import * as core from '@actions/core'
export async function restoreCachedWrapperDist(
executableDirectory: string
): Promise<void> {
core.saveState('GC_WRAPPER_BASE_DIR', executableDirectory)
}
export async function cacheWrapperDist(): Promise<void> {
core.info(`GC_WRAPPER_BASE_DIR = ${core.getState('GC_WRAPPER_BASE_DIR')}`)
}

View file

@ -2,6 +2,7 @@ import * as core from '@actions/core'
import * as path from 'path' import * as path from 'path'
import {parseArgsStringToArgv} from 'string-argv' import {parseArgsStringToArgv} from 'string-argv'
import * as cache from './cache'
import * as execution from './execution' import * as execution from './execution'
import * as gradlew from './gradlew' import * as gradlew from './gradlew'
import * as provision from './provision' import * as provision from './provision'
@ -48,6 +49,8 @@ async function resolveGradleExecutable(baseDirectory: string): Promise<string> {
? path.join(baseDirectory, wrapperDirectory) ? path.join(baseDirectory, wrapperDirectory)
: baseDirectory : baseDirectory
await cache.restoreCachedWrapperDist(executableDirectory)
return path.resolve(executableDirectory, gradlew.wrapperFilename()) return path.resolve(executableDirectory, gradlew.wrapperFilename())
} }

View file

@ -1,8 +1,10 @@
import * as core from '@actions/core' import * as core from '@actions/core'
import * as cache from './cache'
// Invoked by GitHub Actions // Invoked by GitHub Actions
export async function run(): Promise<void> { export async function run(): Promise<void> {
core.info('POST Gradle Command Action') core.info('POST Gradle Command Action')
await cache.cacheWrapperDist()
} }
run() run()