Created
February 21, 2025 20:49
-
-
Save fmagrosoto/4dbc219e7a6e78649499746492aa5a55 to your computer and use it in GitHub Desktop.
Archivo bash para automatizar la versión de repositorio git
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| echo "Haciendo un bump de la versión..." | |
| # Variables | |
| DEVELOP_BRANCH="develop" | |
| VERSION_BRANCH="version" | |
| MAIN_BRANCH="main" | |
| # Verificar el parámetro de versión | |
| if [ -z "$1" ]; then | |
| echo "Por favor, proporciona el tipo de versión (patch, minor, major) como parámetro." | |
| exit 1 | |
| fi | |
| VERSION_TYPE=$1 | |
| # Ejecutar el script npm con el tipo de versión proporcionado | |
| npm version $VERSION_TYPE | |
| CURRENT_VERSION=$(jq -r '.version' package.json) | |
| # Fusionar la rama version con main | |
| git checkout $MAIN_BRANCH | |
| git merge $VERSION_BRANCH | |
| # Fusionar la rama version con develop | |
| git checkout $DEVELOP_BRANCH | |
| git merge $VERSION_BRANCH | |
| # Borrar la rama version | |
| git branch -d $VERSION_BRANCH | |
| echo "Versión $CURRENT_VERSION completada 🤓." | |
| echo "Todas las ramas han quedado fusionadas." | |
| echo "Ahora es tiempo que las subas al repositorio remoto." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment