fix(build): avoid mirror oisd outside of gitlab pages

This commit is contained in:
MDLeom 2022-01-08 22:12:56 +00:00
parent 67cd8b860c
commit add4913170
No known key found for this signature in database
GPG Key ID: 32D3E28E96A695E8
1 changed files with 7 additions and 1 deletions

View File

@ -5,7 +5,7 @@
const { stream: gotStream } = require('got')
const unzip = require('extract-zip')
const { join } = require('path')
const { mkdir } = require('fs/promises')
const { mkdir, readdir, rm } = require('fs/promises')
const { createWriteStream } = require('fs')
const { pipeline } = require('stream/promises')
@ -13,6 +13,7 @@ const rootPath = join(__dirname, '..')
const tmpPath = join(rootPath, 'tmp')
const zipPath = join(tmpPath, 'artifacts.zip')
const artifactsUrl = 'https://gitlab.com/curben/malware-filter/-/jobs/artifacts/main/download?job=pages'
const publicPath = join(rootPath, 'public')
const f = async () => {
await mkdir(tmpPath, { recursive: true })
@ -25,6 +26,11 @@ const f = async () => {
console.log('Extracting artifacts.zip...')
await unzip(zipPath, { dir: rootPath })
const files = await readdir(publicPath)
for (const file of files) {
if (file.startsWith('oisd')) await rm(join(publicPath, file))
}
}
f()