mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-19 20:19:15 +00:00
fix(ci): ⚡ github action
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "@bot-whatsapp/provider",
|
"name": "@bot-whatsapp/provider",
|
||||||
"version": "0.0.20-alpha.0",
|
"version": "0.0.19-alpha.0",
|
||||||
"description": "Esto es el conector a Twilio, Meta, etc...",
|
"description": "Esto es el conector a Twilio, Meta, etc...",
|
||||||
"main": "./lib/mock/index.cjs",
|
"main": "./lib/mock/index.cjs",
|
||||||
"keywords": [],
|
"keywords": [],
|
||||||
|
|||||||
@@ -82,6 +82,24 @@ const updateVersion = async (packageName = null, number = null) => {
|
|||||||
return { version: newVersion }
|
return { version: newVersion }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const checkExistVersion = async (packageName = null, version = null) => {
|
||||||
|
try {
|
||||||
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
|
const pkgJsonObject = readPackage(packageName)
|
||||||
|
const { stdout } = await cmd(
|
||||||
|
NPM_COMMAND,
|
||||||
|
['view', `${pkgJsonObject.name}@${version}`],
|
||||||
|
{
|
||||||
|
stdio: 'inherit',
|
||||||
|
cwd: pkgJson,
|
||||||
|
}
|
||||||
|
)
|
||||||
|
return true
|
||||||
|
} catch (e) {
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const packRelease = async (packageName) => {
|
const packRelease = async (packageName) => {
|
||||||
const pkgJson = join(PATH_PACKAGES, packageName)
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
||||||
@@ -108,14 +126,19 @@ const publishRelease = async (packageName, latest = null) => {
|
|||||||
|
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
if (PKG_ARG) {
|
if (PKG_ARG) {
|
||||||
|
let EXIST_VERSION = true
|
||||||
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
||||||
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
||||||
const pkgNumber = PKG_ARG_VERSION
|
const pkgNumber = PKG_ARG_VERSION
|
||||||
? PKG_ARG_VERSION.split('=').at(1)
|
? PKG_ARG_VERSION.split('=').at(1)
|
||||||
: null
|
: null
|
||||||
if (tokenNpm) await npmToken(tokenNpm)
|
if (tokenNpm) await npmToken(tokenNpm)
|
||||||
await updateVersion(pkgName, pkgNumber)
|
|
||||||
await packRelease(pkgName)
|
while (EXIST_VERSION) {
|
||||||
|
const { version } = await updateVersion(pkgName, pkgNumber)
|
||||||
|
EXIST_VERSION = await checkExistVersion(pkgName, version)
|
||||||
|
console.log(`[${pkgName} - Version]: `, version, EXIST_VERSION)
|
||||||
|
}
|
||||||
await publishRelease(pkgName, pkgNumber)
|
await publishRelease(pkgName, pkgNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user