@@ -93,19 +93,24 @@ export function extractMajorMinor(version: string) {
9393}
9494
9595export function getCacheKeyPrefix ( ) {
96- // v1 - Before proto v0.24 changes
97- return 'moonrepo-toolchain-v2' ;
96+ // v2 - Before proto v0.24 changes
97+ // v3 - proto v0.51 lockfile changes
98+ return 'moonrepo-toolchain-v3' ;
9899}
99100
100101export async function getToolchainCacheKey ( ) {
101102 const hasher = crypto . createHash ( 'sha1' ) ;
102- const files = [ '.prototools' ] ;
103+ const files = [ '.prototools' , '.protolock' ] ;
103104
104105 if ( isUsingMoon ( ) ) {
105106 const root = core . getInput ( 'workspace-root' ) ;
106107
107108 if ( root ) {
108- files . push ( path . join ( root , '.prototools' ) , path . join ( root , '.moon/toolchain.yml' ) ) ;
109+ files . push (
110+ path . join ( root , '.prototools' ) ,
111+ path . join ( root , '.protolock' ) ,
112+ path . join ( root , '.moon/toolchain.yml' ) ,
113+ ) ;
109114 } else {
110115 files . push ( '.moon/toolchain.yml' ) ;
111116 }
@@ -115,15 +120,15 @@ export async function getToolchainCacheKey() {
115120
116121 hasher . update ( await glob . hashFiles ( files . join ( '\n' ) ) ) ;
117122
118- const protoVersion = process . env . PROTO_CLI_VERSION ;
123+ const protoVersion = process . env . PROTO_CLI_VERSION ?? core . getState ( 'PROTO_CLI_VERSION' ) ;
119124
120125 if ( protoVersion ) {
121126 core . debug ( `Hashing proto version: ${ protoVersion } ` ) ;
122127
123128 hasher . update ( extractMajorMinor ( protoVersion ) ) ;
124129 }
125130
126- const moonVersion = process . env . MOON_CLI_VERSION ;
131+ const moonVersion = process . env . MOON_CLI_VERSION ?? core . getState ( 'MOON_CLI_VERSION' ) ;
127132
128133 if ( moonVersion ) {
129134 core . debug ( `Hashing moon version: ${ moonVersion } ` ) ;
@@ -185,8 +190,11 @@ export async function installBin(bin: string) {
185190 const result = await execa ( binPath , [ '--version' ] , { stdio : 'pipe' } ) ;
186191
187192 if ( result . stdout ) {
193+ const v = result . stdout . replace ( bin , '' ) . trim ( ) ;
194+
188195 // eslint-disable-next-line require-atomic-updates
189- process . env [ `${ envPrefix } _CLI_VERSION` ] = result . stdout . replace ( bin , '' ) . trim ( ) ;
196+ process . env [ `${ envPrefix } _CLI_VERSION` ] = v ;
197+ core . saveState ( `${ envPrefix } _CLI_VERSION` , v ) ;
190198
191199 core . info ( result . stdout ) ;
192200 }
0 commit comments