minetest_x_bows/scripts/deploy.js

33 lines
736 B
JavaScript
Raw Normal View History

2022-11-02 23:04:43 -05:00
import fetch from 'node-fetch'
import yargs from 'yargs/yargs'
import {hideBin} from 'yargs/helpers'
const argv = yargs(hideBin(process.argv)).argv
try {
const body = {
method: 'git',
title: argv.title,
ref: 'master'
}
const response = await fetch('https://content.minetest.net/api/packages/SaKeL/x_bows/releases/new/', {
method: 'POST',
body: JSON.stringify(body),
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${argv.token}`
}
})
const data = await response.json()
2022-11-02 23:19:09 -05:00
console.log(data)
2022-11-02 23:22:03 -05:00
if (!data.success) {
2022-11-02 23:04:43 -05:00
process.exit(1)
}
} catch (error) {
console.log(error)
process.exit(1)
}