Unverified Commit 13e83e14 authored by Sebastian "Sebbie" Silbermann's avatar Sebastian "Sebbie" Silbermann Committed by GitHub

[ci] Add support for private preview builds (#93375)

parent a35edcfb
...@@ -67,4 +67,5 @@ jobs: ...@@ -67,4 +67,5 @@ jobs:
github.event.workflow_run.head_sha }}" "${{ runner.temp github.event.workflow_run.head_sha }}" "${{ runner.temp
}}/preview-tarballs" }}/preview-tarballs"
env: env:
BLOB_ACCESS: ${{ vars.PREVIEW_BUILDS_ACCESS }}
BLOB_READ_WRITE_TOKEN: ${{ secrets.PREVIEW_BUILDS_BLOB_READ_WRITE_TOKEN }} BLOB_READ_WRITE_TOKEN: ${{ secrets.PREVIEW_BUILDS_BLOB_READ_WRITE_TOKEN }}
...@@ -58,6 +58,12 @@ async function main() { ...@@ -58,6 +58,12 @@ async function main() {
if (!process.env.BLOB_READ_WRITE_TOKEN) { if (!process.env.BLOB_READ_WRITE_TOKEN) {
throw new Error('BLOB_READ_WRITE_TOKEN environment variable is required') throw new Error('BLOB_READ_WRITE_TOKEN environment variable is required')
} }
const blobAccess = process.env.BLOB_ACCESS
if (blobAccess !== 'private' && blobAccess !== 'public') {
throw new Error(
`BLOB_ACCESS environment variable can only be "private" or "public" but got "${blobAccess}".`
)
}
for await (const { packageName, tarballPath } of findTarballs( for await (const { packageName, tarballPath } of findTarballs(
tarballDirectory tarballDirectory
...@@ -66,7 +72,7 @@ async function main() { ...@@ -66,7 +72,7 @@ async function main() {
const fileBuffer = await fs.readFile(tarballPath) const fileBuffer = await fs.readFile(tarballPath)
const { url } = await put(blobPathname, fileBuffer, { const { url } = await put(blobPathname, fileBuffer, {
access: 'public', access: blobAccess,
addRandomSuffix: false, addRandomSuffix: false,
contentType: 'application/gzip', contentType: 'application/gzip',
}) })
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment