mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 04:29:16 +00:00
6
.github/workflows/releases.yml
vendored
6
.github/workflows/releases.yml
vendored
@@ -1,8 +1,7 @@
|
|||||||
name: BotWhatsapp Releases
|
name: BotWhatsapp Releases
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
push:
|
||||||
types: [closed]
|
|
||||||
branches:
|
branches:
|
||||||
- next-release
|
- next-release
|
||||||
|
|
||||||
@@ -11,7 +10,6 @@ jobs:
|
|||||||
release:
|
release:
|
||||||
name: Release
|
name: Release
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
if: github.event.pull_request.merged == 'true'
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -55,4 +53,4 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
message: 'ci(version): :zap: automatic - ${date} updated versions every packages'
|
message: 'ci(version): :zap: automatic - ${date} updated versions every packages'
|
||||||
branch: 'next-release'
|
branch: 'dev'
|
||||||
|
|||||||
@@ -82,6 +82,12 @@ const updateVersion = async (packageName = null, number = null) => {
|
|||||||
return { version: newVersion }
|
return { version: newVersion }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Revisar si la version nueva existe o no en npmjs
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} version
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
const checkExistVersion = async (packageName = null, version = null) => {
|
const checkExistVersion = async (packageName = null, version = null) => {
|
||||||
try {
|
try {
|
||||||
const pkgJson = join(PATH_PACKAGES, packageName)
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
@@ -100,6 +106,11 @@ const checkExistVersion = async (packageName = null, version = null) => {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Empaquetar
|
||||||
|
* @param {*} packageName
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
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'], {
|
||||||
@@ -109,6 +120,12 @@ const packRelease = async (packageName) => {
|
|||||||
return stdout
|
return stdout
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Lanzar release
|
||||||
|
* @param {*} packageName
|
||||||
|
* @param {*} latest
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
const publishRelease = async (packageName, latest = null) => {
|
const publishRelease = async (packageName, latest = null) => {
|
||||||
const args = !latest ? ['--tag', 'dev'] : ['--access', 'public']
|
const args = !latest ? ['--tag', 'dev'] : ['--access', 'public']
|
||||||
const pkgJson = join(PATH_PACKAGES, packageName)
|
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||||
@@ -124,6 +141,9 @@ const publishRelease = async (packageName, latest = null) => {
|
|||||||
* Recibe los argumentos entrantes
|
* Recibe los argumentos entrantes
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Init
|
||||||
|
*/
|
||||||
const main = async () => {
|
const main = async () => {
|
||||||
if (PKG_ARG) {
|
if (PKG_ARG) {
|
||||||
let EXIST_VERSION = true
|
let EXIST_VERSION = true
|
||||||
@@ -139,6 +159,7 @@ const main = async () => {
|
|||||||
EXIST_VERSION = await checkExistVersion(pkgName, version)
|
EXIST_VERSION = await checkExistVersion(pkgName, version)
|
||||||
console.log(`[${pkgName} - Version]: `, version, EXIST_VERSION)
|
console.log(`[${pkgName} - Version]: `, version, EXIST_VERSION)
|
||||||
}
|
}
|
||||||
|
await packRelease(pkgName)
|
||||||
await publishRelease(pkgName, pkgNumber)
|
await publishRelease(pkgName, pkgNumber)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user