mirror of
https://github.com/cheveguerra/bot-whatsapp.git
synced 2026-04-20 20:49:15 +00:00
Compare commits
11 Commits
leifermend
...
fix/versio
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
6a86da2851 | ||
|
|
248d04b666 | ||
|
|
7790391b50 | ||
|
|
4142ca4fd5 | ||
|
|
2ce342a0cb | ||
|
|
dfced8c594 | ||
|
|
9ddf144244 | ||
|
|
b465de55a0 | ||
|
|
739c63d025 | ||
|
|
8d897f824e | ||
|
|
e48b29ed29 |
55
.github/workflows/ci.yml
vendored
55
.github/workflows/ci.yml
vendored
@@ -1,12 +1,8 @@
|
||||
name: BotWhatsapp CI
|
||||
name: BotWhatsapp Build-Test
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- main
|
||||
pull_request:
|
||||
branches:
|
||||
- main
|
||||
- dev
|
||||
|
||||
jobs:
|
||||
@@ -38,55 +34,6 @@ jobs:
|
||||
- name: Build Eslint rules
|
||||
run: yarn lint:fix
|
||||
|
||||
############ RELEASE ############
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
needs:
|
||||
- build-package
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'yarn'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- run: corepack enable
|
||||
|
||||
- name: Install NPM Dependencies
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: Build Package
|
||||
run: yarn build
|
||||
|
||||
- name: Release @bot-whatsapp/bot
|
||||
run: yarn node ./scripts/release.js --name=bot --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/cli
|
||||
run: yarn node ./scripts/release.js --name=cli --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/create-bot-whatsapp
|
||||
run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/database
|
||||
run: yarn node ./scripts/release.js --name=database --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/provider
|
||||
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Commit Versioning
|
||||
run: |
|
||||
git config --global user.name 'Leifer Mendez (githubaction)'
|
||||
git config --global user.email 'leifermendez@users.noreply.github.com'
|
||||
git commit -am "ci(version): :zap: updated versions every packages"
|
||||
git push
|
||||
|
||||
############ UNIT TEST ############
|
||||
test-unit:
|
||||
name: Unit Tests
|
||||
|
||||
56
.github/workflows/releases.yml
vendored
Normal file
56
.github/workflows/releases.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
name: BotWhatsapp Releases
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- next-release
|
||||
|
||||
jobs:
|
||||
############ RELEASE ############
|
||||
release:
|
||||
name: Release
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
ref: ${{ github.head_ref }}
|
||||
persist-credentials: false
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Node
|
||||
uses: actions/setup-node@v3
|
||||
with:
|
||||
node-version: 16.x
|
||||
cache: 'yarn'
|
||||
registry-url: https://registry.npmjs.org/
|
||||
|
||||
- run: corepack enable
|
||||
|
||||
- name: Install NPM Dependencies
|
||||
run: yarn install --immutable --network-timeout 300000
|
||||
|
||||
- name: Build Package
|
||||
run: yarn build
|
||||
|
||||
- name: Release @bot-whatsapp/bot
|
||||
run: yarn node ./scripts/release.js --name=bot --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/cli
|
||||
run: yarn node ./scripts/release.js --name=cli --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/create-bot-whatsapp
|
||||
run: yarn node ./scripts/release.js --name=create-bot-whatsapp --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/database
|
||||
run: yarn node ./scripts/release.js --name=database --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Release @bot-whatsapp/provider
|
||||
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
|
||||
|
||||
- name: Commit Versioning & Push changes
|
||||
uses: actions-js/push@master
|
||||
with:
|
||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||
message: 'ci(version): :zap: automatic - ${date} updated versions every packages'
|
||||
branch: 'dev'
|
||||
@@ -4,7 +4,7 @@
|
||||
🦊 Documentación: [https://bot-whatsapp.pages.dev/](https://bot-whatsapp.pages.dev/)
|
||||
Video como hacer PR: https://youtu.be/Lxt8Acob6aU
|
||||
|
||||
- [ ] Evitar dependencias
|
||||
🚀 __Roadmap:__ [https://github.com/users/leifermendez/projects/4/views/1](https://github.com/users/leifermendez/projects/4/views/1)
|
||||
|
||||
|
||||
**Comunidad**
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/bot",
|
||||
"version": "0.0.12-alpha.0",
|
||||
"version": "0.0.15-alpha.0",
|
||||
"description": "",
|
||||
"main": "./lib/bundle.bot.cjs",
|
||||
"scripts": {
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/cli",
|
||||
"version": "0.0.19-alpha.0",
|
||||
"version": "0.0.22-alpha.0",
|
||||
"description": "",
|
||||
"main": "index.js",
|
||||
"devDependencies": {
|
||||
|
||||
0
packages/create-bot-whatsapp/bin/create.js
Normal file → Executable file
0
packages/create-bot-whatsapp/bin/create.js
Normal file → Executable file
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "create-bot-whatsapp",
|
||||
"version": "0.0.25-alpha.0",
|
||||
"version": "0.0.28-alpha.0",
|
||||
"description": "",
|
||||
"main": "./lib/bundle.create-bot-whatsapp.cjs",
|
||||
"files": [
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/database",
|
||||
"version": "0.0.11-alpha.0",
|
||||
"version": "0.0.14-alpha.0",
|
||||
"description": "Esto es el conector a mysql, pg, mongo",
|
||||
"main": "./lib/mock/index.cjs",
|
||||
"keywords": [],
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "@bot-whatsapp/provider",
|
||||
"version": "0.0.17-alpha.0",
|
||||
"version": "0.0.19-alpha.0",
|
||||
"description": "Esto es el conector a Twilio, Meta, etc...",
|
||||
"main": "./lib/mock/index.cjs",
|
||||
"keywords": [],
|
||||
|
||||
@@ -82,6 +82,35 @@ 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)
|
||||
const pkgJsonObject = readPackage(packageName)
|
||||
const { stdout } = await cmd(
|
||||
NPM_COMMAND,
|
||||
['view', `${pkgJsonObject.name}@${version}`],
|
||||
{
|
||||
stdio: 'inherit',
|
||||
cwd: pkgJson,
|
||||
}
|
||||
)
|
||||
return true
|
||||
} catch (e) {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Empaquetar
|
||||
* @param {*} packageName
|
||||
* @returns
|
||||
*/
|
||||
const packRelease = async (packageName) => {
|
||||
const pkgJson = join(PATH_PACKAGES, packageName)
|
||||
const { stdout } = await cmd(NPM_COMMAND, ['pack'], {
|
||||
@@ -91,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)
|
||||
@@ -106,15 +141,24 @@ const publishRelease = async (packageName, latest = null) => {
|
||||
* Recibe los argumentos entrantes
|
||||
*/
|
||||
|
||||
/**
|
||||
* Init
|
||||
*/
|
||||
const main = async () => {
|
||||
if (PKG_ARG) {
|
||||
let EXIST_VERSION = true
|
||||
const tokenNpm = NPM_TOKEN ? NPM_TOKEN.split('=').at(1) : null
|
||||
const pkgName = PKG_ARG ? PKG_ARG.split('=').at(1) : null
|
||||
const pkgNumber = PKG_ARG_VERSION
|
||||
? PKG_ARG_VERSION.split('=').at(1)
|
||||
: null
|
||||
if (tokenNpm) await npmToken(tokenNpm)
|
||||
await updateVersion(pkgName, pkgNumber)
|
||||
|
||||
while (EXIST_VERSION) {
|
||||
const { version } = await updateVersion(pkgName, pkgNumber)
|
||||
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