mirror of
				https://github.com/gradle/gradle-build-action.git
				synced 2025-11-04 09:58:56 +08:00 
			
		
		
		
	Cache wrapper dist, step 1
This commit is contained in:
		
							
								
								
									
										11
									
								
								src/cache.ts
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										11
									
								
								src/cache.ts
									
									
									
									
									
										Normal 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')}`)
 | 
			
		||||
}
 | 
			
		||||
@@ -2,6 +2,7 @@ import * as core from '@actions/core'
 | 
			
		||||
import * as path from 'path'
 | 
			
		||||
import {parseArgsStringToArgv} from 'string-argv'
 | 
			
		||||
 | 
			
		||||
import * as cache from './cache'
 | 
			
		||||
import * as execution from './execution'
 | 
			
		||||
import * as gradlew from './gradlew'
 | 
			
		||||
import * as provision from './provision'
 | 
			
		||||
@@ -48,6 +49,8 @@ async function resolveGradleExecutable(baseDirectory: string): Promise<string> {
 | 
			
		||||
            ? path.join(baseDirectory, wrapperDirectory)
 | 
			
		||||
            : baseDirectory
 | 
			
		||||
 | 
			
		||||
    await cache.restoreCachedWrapperDist(executableDirectory)
 | 
			
		||||
 | 
			
		||||
    return path.resolve(executableDirectory, gradlew.wrapperFilename())
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,8 +1,10 @@
 | 
			
		||||
import * as core from '@actions/core'
 | 
			
		||||
import * as cache from './cache'
 | 
			
		||||
 | 
			
		||||
// Invoked by GitHub Actions
 | 
			
		||||
export async function run(): Promise<void> {
 | 
			
		||||
    core.info('POST Gradle Command Action')
 | 
			
		||||
    await cache.cacheWrapperDist()
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
run()
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user