Skip to content

Commit

Permalink
write zip file in path
Browse files Browse the repository at this point in the history
  • Loading branch information
iTrooz committed Jun 18, 2022
1 parent 27fee4d commit 96c9a03
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions main.js
Expand Up @@ -190,26 +190,26 @@ async function main() {
archive_format: "zip",
})

const basePath = name ? path : pathname.join(path, artifact.name)
if (skipUnpack) {
fs.writeFileSync(`${artifact.name}.zip`, Buffer.from(zip.data), 'binary')
fs.writeFileSync(`${basePath}.zip`, Buffer.from(zip.data), 'binary')
continue
}

const dir = name ? path : pathname.join(path, artifact.name)

fs.mkdirSync(dir, { recursive: true })
fs.mkdirSync(basePath, { recursive: true })

const adm = new AdmZip(Buffer.from(zip.data))

core.startGroup(`==> Extracting: ${artifact.name}.zip`)
adm.getEntries().forEach((entry) => {
const action = entry.isDirectory ? "creating" : "inflating"
const filepath = pathname.join(dir, entry.entryName)
const filepath = pathname.join(basePath, entry.entryName)

core.info(` ${action}: ${filepath}`)
})

adm.extractAllTo(dir, true)
adm.extractAllTo(basePath, true)
core.endGroup()
}
} catch (error) {
Expand Down

0 comments on commit 96c9a03

Please sign in to comment.