Merge pull request #468 from codigoencasa/release/production

Release/production
This commit is contained in:
Leifer Mendez
2023-01-11 16:32:27 +01:00
committed by GitHub
13 changed files with 97 additions and 54 deletions

View File

@@ -3,7 +3,7 @@ name: 📄 (PROD) Desplegando documentacion
on:
push:
branches:
- next-release
- release/next
jobs:
############ DOCUMENTATION BUILD ############

View File

@@ -44,6 +44,9 @@ jobs:
- name: Release @bot-whatsapp/provider
run: yarn node ./scripts/release.js --name=provider --version= --token="${{ secrets.NPM_TOKEN }}"
- name: Release @bot-whatsapp/contexts
run: yarn node ./scripts/release.js --name=contexts --version= --token="${{ secrets.NPM_TOKEN }}"
- name: Release @bot-whatsapp/portal
run: yarn node ./scripts/release.js --name=portal --version= --token="${{ secrets.NPM_TOKEN }}"

View File

@@ -57,11 +57,17 @@ jobs:
- name: Release @bot-whatsapp/provider
run: yarn node ./scripts/release.js --name=provider --version="${{ steps.package-version.outputs.current-version}}" --token="${{ secrets.NPM_TOKEN }}"
- name: Release @bot-whatsapp/contexts
run: yarn node ./scripts/release.js --name=contexts --version="${{ steps.package-version.outputs.current-version}}" --token="${{ secrets.NPM_TOKEN }}"
- name: Release @bot-whatsapp/portal
run: yarn node ./scripts/release.js --name=portal --version="${{ steps.package-version.outputs.current-version}}" --token="${{ secrets.NPM_TOKEN }}"
- name: Commit and push changes
uses: devops-infra/action-commit-push@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
commit_message: 'release(version): 🚀 - "${{ steps.package-version.outputs.current-version}}" release'
- name: Release Github
run: yarn node ./scripts/github.js --version="${{ steps.package-version.outputs.current-version}}" --token="${{ secrets.OCTO_TOKEN }}"
- name: GIT commit and push all changed files
if: github.event_name == 'push'
run: |
git commit -a -m 'chore(version): launch release 🚀 "${{ steps.package-version.outputs.current-version}}"'
git push

View File

@@ -2,6 +2,31 @@
All notable changes to this project will be documented in this file. See [standard-version](https://github.com/conventional-changelog/standard-version) for commit guidelines.
### [0.1.13](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.12...v0.1.13) (2023-01-11)
### [0.1.12](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.10...v0.1.12) (2023-01-11)
### [0.1.9-pre](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.9...v0.1.9-pre) (2023-01-10)
### [0.1.7-pre-1](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.7-alpha...v0.1.7-pre-1) (2023-01-10)
### [0.1.7-alpha](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.7-pre...v0.1.7-alpha) (2023-01-10)
### [0.1.11](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.10...v0.1.11) (2023-01-11)
### [0.1.9-pre](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.9...v0.1.9-pre) (2023-01-10)
### [0.1.7-pre-1](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.7-alpha...v0.1.7-pre-1) (2023-01-10)
### [0.1.7-alpha](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.7-pre...v0.1.7-alpha) (2023-01-10)
### [0.1.10](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.8...v0.1.10) (2023-01-11)
### Bug Fixes
* :fire: update qr package ([ecde23f](https://github.com/leifermendez/bot-whatsapp/commit/ecde23fdea65def209aa874af35a3f293e6b1a91))
### [0.1.8](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.7-pre...v0.1.8) (2023-01-10)
### [0.1.7](https://github.com/leifermendez/bot-whatsapp/compare/v0.1.7-pre...v0.1.7) (2023-01-10)

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/root",
"version": "0.1.8",
"version": "0.1.13",
"description": "Bot de wahtsapp open source para MVP o pequeños negocios",
"main": "app.js",
"private": true,
@@ -67,6 +67,7 @@
"devDependencies": {
"@commitlint/cli": "^17.3.0",
"@commitlint/config-conventional": "^17.3.0",
"@octokit/core": "^4.1.0",
"@rollup/plugin-commonjs": "^23.0.2",
"@rollup/plugin-json": "^5.0.1",
"@rollup/plugin-node-resolve": "^15.0.1",
@@ -97,8 +98,5 @@
"npm": "please-use-yarn",
"yarn": ">=3"
},
"author": "Leifer Mendez <leifer33@gmail.com>",
"dependencies": {
"@octokit/core": "^4.1.0"
}
"author": "Leifer Mendez <leifer33@gmail.com>"
}

View File

@@ -1,6 +1,6 @@
{
"name": "@bot-whatsapp/contexts",
"version": "0.0.1",
"version": "0.0.4-alpha.0",
"description": "",
"main": "./lib/bundle.contexts.cjs",
"files": [

View File

@@ -1,5 +1,5 @@
{
"dependencies": {
"twilio": "3.84.0"
"twilio": "3.84.1"
}
}

47
scripts/github.js Normal file
View File

@@ -0,0 +1,47 @@
const process = require('node:process')
const { Octokit } = require('@octokit/core')
const [PKG_ARG, GITHUB_TOKEN] = process.argv.slice(2) || [null]
/**
* Publicar Release en Github
* @param {*} name
* @param {*} tag_name
* @param {*} auth
* @param {*} owner
* @param {*} repo
*/
const githubGithubRelease = async (
name = '',
tag_name = '',
auth = '',
owner = 'codigoencasa',
repo = 'bot-whatsapp'
) => {
const octokit = new Octokit({
auth,
})
await octokit.request(`POST /repos/${owner}/${repo}/releases`, {
owner,
repo,
tag_name,
name,
body: 'Description of the release',
draft: false,
prerelease: false,
generate_release_notes: true,
})
}
const main = async () => {
if (PKG_ARG) {
const githubToken = GITHUB_TOKEN ? GITHUB_TOKEN.split('=').at(1) : null
const pkgNumber = PKG_ARG ? PKG_ARG.split('=').at(1) : null
if (pkgNumber)
await githubGithubRelease(`v${pkgNumber}`, pkgNumber, githubToken)
}
}
main()

View File

@@ -3,50 +3,16 @@ const { join } = require('path')
const { execFile } = require('node:child_process')
const process = require('node:process')
const util = require('node:util')
const { Octokit } = require('@octokit/core')
const OS_ENVIROMENT_WIN = process.platform.includes('win32')
const semver = require('semver')
const NPM_COMMAND = OS_ENVIROMENT_WIN ? 'npm.cmd' : 'npm'
const [PKG_ARG, PKG_ARG_VERSION, NPM_TOKEN, GITHUB_TOKEN] = process.argv.slice(
2
) || [null]
const [PKG_ARG, PKG_ARG_VERSION, NPM_TOKEN] = process.argv.slice(2) || [null]
const PATH_PACKAGES = join(__dirname, '..', `packages`)
const cmd = util.promisify(execFile)
/**
* Publicar Release en Github
* @param {*} name
* @param {*} tag_name
* @param {*} auth
* @param {*} owner
* @param {*} repo
*/
const githubGithubRelease = async (
name = '',
tag_name = '',
auth = '',
owner = 'codigoencasa',
repo = 'bot-whatsapp'
) => {
const octokit = new Octokit({
auth,
})
await octokit.request(`POST /repos/${owner}/${repo}/releases`, {
owner,
repo,
tag_name,
name,
body: 'Description of the release',
draft: false,
prerelease: false,
generate_release_notes: true,
})
}
/**
* Create Token
*/
@@ -181,7 +147,6 @@ const publishRelease = async (packageName, latest = null) => {
const main = async () => {
if (PKG_ARG) {
let EXIST_VERSION = true
const githubToken = GITHUB_TOKEN ? GITHUB_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 pkgNumber = PKG_ARG_VERSION
@@ -196,7 +161,6 @@ const main = async () => {
}
await packRelease(pkgName)
await publishRelease(pkgName, pkgNumber)
await githubGithubRelease(`v${pkgNumber}`, pkgNumber, githubToken)
}
}

View File

@@ -11,7 +11,7 @@
"dependencies": {
"body-parser": "^1.20.1",
"polka": "^0.5.2",
"twilio": "3.84.0",
"twilio": "3.84.1",
"@bot-whatsapp/bot": "latest",
"@bot-whatsapp/cli": "latest",
"@bot-whatsapp/database": "latest",

View File

@@ -11,7 +11,7 @@
"dependencies": {
"body-parser": "^1.20.1",
"polka": "^0.5.2",
"twilio": "3.84.0",
"twilio": "3.84.1",
"@bot-whatsapp/bot": "latest",
"@bot-whatsapp/cli": "latest",
"@bot-whatsapp/database": "latest",

View File

@@ -11,7 +11,7 @@
"dependencies": {
"body-parser": "^1.20.1",
"polka": "^0.5.2",
"twilio": "3.84.0",
"twilio": "3.84.1",
"@bot-whatsapp/bot": "latest",
"@bot-whatsapp/cli": "latest",
"@bot-whatsapp/database": "latest",

View File

@@ -11,7 +11,7 @@
"dependencies": {
"body-parser": "^1.20.1",
"polka": "^0.5.2",
"twilio": "3.84.0",
"twilio": "3.84.1",
"@bot-whatsapp/bot": "latest",
"@bot-whatsapp/cli": "latest",
"@bot-whatsapp/database": "latest",