diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a7d3f04..6010998 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -52,6 +52,10 @@ jobs: working-directory: main/website run: yarn install --frozen-lockfile + - name: Install dependencies (upcoming) + working-directory: upcoming/website + run: yarn install --frozen-lockfile + - name: Download language docs working-directory: main/website run: yarn ts-node download_links.ts docs_py docs_cxx docs_java @@ -63,10 +67,6 @@ jobs: GITHUB_ORIGIN: ${{ steps.setup-pages.outputs.origin }} GITHUB_BASE_PATH: ${{ steps.setup-pages.outputs.base_path }} - - name: Install dependencies (upcoming) - working-directory: upcoming/website - run: yarn install --frozen-lockfile - - name: Build webpage for `upcoming` branch working-directory: upcoming/website run: yarn build diff --git a/website/download_links.ts b/website/download_links.ts index 4fd4137..e3d510e 100644 --- a/website/download_links.ts +++ b/website/download_links.ts @@ -1,33 +1,18 @@ -import https from 'https'; -import fs from 'fs'; import { config } from './src/config'; +import { spawn } from 'child_process'; function downloadFile(targetPath: string, url: string) { - console.log(`Downloading ${url}`); - return new Promise(( resolve, reject ) => { - const file = fs.createWriteStream(targetPath); - const request = https.get(url, function(response) { - response.pipe(file); - - // after download completed close filestream - file.on("finish", () => { - file.close(); - console.log("Download Completed"); - resolve(); - }); - file.on('error', (e)=> { - file.close(); - reject(e); - }); - }); - }); + const cmd = `curl --output ${targetPath} ${url}` + console.log(`Downloading ${url} to ${targetPath}`); + console.log(cmd) + spawn(cmd, [], { shell: true, stdio: 'inherit' }) } async function downloadArtifact(artifactName: string) { const url = config.download[artifactName]; if(!url) throw `Unknown artifact ${artifactName}` const fileSuffix = url.split(".").slice(-1); - await downloadFile(artifactName + "." + fileSuffix, url) + downloadFile(artifactName + "." + fileSuffix, url) } async function doDownloads() {