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