Skip to content

Commit 0964b11

Browse files
Next rollout (#577)
* Test sha * Trim whitespace * Use short * Update comments
1 parent aeec1f4 commit 0964b11

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

scripts/upload-assets.js

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ async function uploadAssets() {
4040
.map(i => `id=${i}`)
4141
.join(',');
4242

43+
const sha = require('child_process').execSync('git rev-parse --short HEAD').toString().trim();
44+
4345
if (bucket === undefined) {
4446
throw new Error('bucket required');
4547
}
@@ -130,10 +132,22 @@ async function uploadAssets() {
130132

131133
await Promise.all(uploads);
132134

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
134148
.putObject({
135149
Bucket: bucket,
136-
Key: key('/manifest.json'),
150+
Key: key(`/manifest-${sha}.json`),
137151
Body: zlib.gzipSync(JSON.stringify(manifest)),
138152
ContentEncoding: process.env.CONTENT_ENCODING,
139153
GrantRead: cfCanonicalUserIdsParsed,

0 commit comments

Comments
 (0)