@@ -40,6 +40,8 @@ async function uploadAssets() {
40
40
. map ( i => `id=${ i } ` )
41
41
. join ( ',' ) ;
42
42
43
+ const sha = require ( 'child_process' ) . execSync ( 'git rev-parse --short HEAD' ) . toString ( ) . trim ( ) ;
44
+
43
45
if ( bucket === undefined ) {
44
46
throw new Error ( 'bucket required' ) ;
45
47
}
@@ -130,10 +132,22 @@ async function uploadAssets() {
130
132
131
133
await Promise . all ( uploads ) ;
132
134
133
- await s3 // upload manifest file
135
+ await s3 // upload "latest" manifest file
136
+ . putObject ( {
137
+ Bucket : bucket ,
138
+ Key : key ( '/manifest-latest.json' ) ,
139
+ Body : zlib . gzipSync ( JSON . stringify ( manifest ) ) ,
140
+ ContentEncoding : process . env . CONTENT_ENCODING ,
141
+ GrantRead : cfCanonicalUserIdsParsed ,
142
+ GrantFullControl : `id=${ platformCanonicalUserId } ` ,
143
+ ContentType : 'application/json'
144
+ } )
145
+ . promise ( ) ;
146
+
147
+ await s3 // upload hash manifest file
134
148
. putObject ( {
135
149
Bucket : bucket ,
136
- Key : key ( ' /manifest.json' ) ,
150
+ Key : key ( ` /manifest- ${ sha } .json` ) ,
137
151
Body : zlib . gzipSync ( JSON . stringify ( manifest ) ) ,
138
152
ContentEncoding : process . env . CONTENT_ENCODING ,
139
153
GrantRead : cfCanonicalUserIdsParsed ,
0 commit comments