ci: linux arm64

This commit is contained in:
purocean
2022-12-12 17:40:32 +08:00
parent ff37833395
commit e2c8cb163c
3 changed files with 20 additions and 3 deletions
+10 -2
View File
@@ -3,8 +3,12 @@ const fs = require('fs')
const path = require('path')
const request = require('request')
const forceArm64 = process.argv.includes('--force-arm64')
const filename = os.platform() + '-' + 'pandoc-2.14.2' + (os.platform() === 'win32' ? '.exe' : '')
const downloadUrl = 'https://github.com/purocean/yn/releases/download/v1.1/' + filename
const downloadUrl = 'https://github.com/purocean/yn/releases/download/v1.1/' + (forceArm64 ? (filename + '-arm64') : filename)
console.info('Download pandoc', downloadUrl, filename)
const dir = path.join(__dirname, '../bin')
if (!fs.existsSync(dir)) {
@@ -13,7 +17,11 @@ if (!fs.existsSync(dir)) {
const filePath = path.join(dir, filename)
if (fs.existsSync(filePath)) {
console.warn('Pandoc exists. Skip download.', filePath)
if (forceArm64) {
fs.unlinkSync(filePath)
} else {
console.warn('Pandoc exists. Skip download.', filePath)
}
} else {
console.info('Download pandoc', downloadUrl, filename, filePath)
request(downloadUrl).pipe(fs.createWriteStream(filePath, { mode: 0o755 }))