diff --git a/.github/workflows/deploy.yaml b/.github/workflows/deploy.yaml index a7d3f04..50cfac7 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/deploy.yaml @@ -54,7 +54,9 @@ jobs: - name: Download language docs working-directory: main/website - run: yarn ts-node download_links.ts docs_py docs_cxx docs_java + run: | + yarn ts-node download_links.ts docs_py docs_cxx docs_java + ls -lisah . - name: Build webpage for `main` branch working-directory: main/website diff --git a/website/download_links.ts b/website/download_links.ts index 4fd4137..051fcdb 100644 --- a/website/download_links.ts +++ b/website/download_links.ts @@ -3,19 +3,19 @@ import fs from 'fs'; import { config } from './src/config'; function downloadFile(targetPath: string, url: string) { - console.log(`Downloading ${url}`); - return new Promise(( resolve, reject ) => { + console.log(`Downloading ${url} to ${targetPath}`); + return new Promise((resolve, reject) => { const file = fs.createWriteStream(targetPath); - const request = https.get(url, function(response) { + 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.on('error', (e) => { file.close(); reject(e); }); @@ -25,7 +25,7 @@ function downloadFile(targetPath: string, url: string) { async function downloadArtifact(artifactName: string) { const url = config.download[artifactName]; - if(!url) throw `Unknown artifact ${artifactName}` + if (!url) throw `Unknown artifact ${artifactName}` const fileSuffix = url.split(".").slice(-1); await downloadFile(artifactName + "." + fileSuffix, url) }