Skip to content

Commit

Permalink
Print artifacts after downloading
Browse files Browse the repository at this point in the history
  • Loading branch information
ankoh committed May 6, 2024
1 parent 6a3855b commit f427153
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/deploy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
12 changes: 6 additions & 6 deletions website/download_links.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>(( resolve, reject ) => {
console.log(`Downloading ${url} to ${targetPath}`);
return new Promise<void>((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);
});
Expand All @@ -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)
}
Expand Down

0 comments on commit f427153

Please sign in to comment.