1
0
mirror of https://bitbucket.org/minetest_gamers/x_enchanting.git synced 2025-04-21 17:50:21 +02:00
x_enchanting/scripts/deploy.js
2022-11-09 15:39:27 -05:00

33 lines
742 B
JavaScript

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_enchanting/releases/new/', {
method: 'POST',
body: JSON.stringify(body),
headers: {
'Content-Type': 'application/json',
Authorization: `Bearer ${argv.token}`
}
})
const data = await response.json()
console.log(data)
if (!data.success) {
process.exit(1)
}
} catch (error) {
console.log(error)
process.exit(1)
}