Created
December 7, 2024 17:46
-
-
Save BrunoLagoa/82141addbdca842b4bb10ca5353e0c7f to your computer and use it in GitHub Desktop.
MakeFile example
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
| .PHONY: update-version update-build-gradle check-jq check_podfile check_build_gradle | |
| # Check if jq is installed | |
| check-jq: | |
| @command -v jq >/dev/null 2>&1 || { echo >&2 "O jq é uma dependência obrigatória e não está instalado. Por favor, instale o jq para o seu sistema operacional:\n\n- macOS: brew install jq\n- Linux: sudo apt-get install jq\n- Windows: Siga as instruções em https://stedolan.github.io/jq/download/ e adicione o jq ao PATH.\n\nEm seguida, tente novamente. ❌"; exit 1; } | |
| # Define the target for updating the version | |
| update-version: check-jq | |
| @name=$$(jq -r .name package.json); \ | |
| current_version=$$(jq -r .version package.json); \ | |
| echo "Atualizando versão do projeto: \033[1m$$name\033[0m"; \ | |
| read -p "Para qual versão deseja atualizar? (Versão atual: $$current_version) " new_version; \ | |
| if [ -z "$$new_version" ]; then \ | |
| echo "É necessário fornecer uma versão para continuar. ❌"; \ | |
| exit 1; \ | |
| fi; \ | |
| echo "Projeto: \033[1m$$name\033[0m"; \ | |
| echo "Versão atual do projeto: \033[1m$$current_version\033[0m"; \ | |
| echo "Versão nova do projeto: \033[1m$$new_version\033[0m"; \ | |
| jq --arg new_version "$$new_version" '.version = $$new_version' package.json > tmp.$$.json && mv tmp.$$.json package.json; \ | |
| echo "Iniciando atualização..."; \ | |
| echo "package.json: \033[1m$$new_version\033[0m ✅"; \ | |
| make check_podfile new_version=$${new_version}; \ | |
| make check_build_gradle new_version=$${new_version} | |
| check_podfile: ## Check if podfile is in sync with podfile.lock | |
| @chmod +x ./scripts/update-podspec.sh; \ | |
| ./scripts/update-podspec.sh $${new_version} | |
| check_build_gradle: ## Update build.gradle version | |
| @chmod +x ./scripts/update-build-gradle.sh; \ | |
| ./scripts/update-build-gradle.sh $${new_version} | |
| update-build-gradle: check-jq ## Update build.gradle version | |
| echo "\033[1mExecutando yarn build-android-bundle...\033[0m"; \ | |
| yarn build-android-bundle; \ | |
| echo "\033[1mExecutando yarn build-ios-bundle...\033[0m"; \ | |
| yarn build-ios-bundle; \ | |
| echo "🎉 Build concluído para Android e iOS 🎉"; \ | |
| .SILENT: check_podfile check_build_gradle update-build-gradle |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment