Auto-commit via make git
This commit is contained in:
parent
c35aaed66b
commit
b6961cd93e
35
Makefile.am
35
Makefile.am
@ -19,7 +19,7 @@ SRC_TAR ?= $(DIST_DIR)/neoricalex-src.tar.gz
|
||||
# ===========================
|
||||
# Alvos principais
|
||||
# ===========================
|
||||
.PHONY: all tarball git release run clean-local
|
||||
.PHONY: all tarball git release run clean-local check-remote
|
||||
|
||||
all: $(DIST_DIR)
|
||||
|
||||
@ -52,19 +52,19 @@ $(SRC_TAR):
|
||||
# ===========================
|
||||
# Git (commit + push)
|
||||
# ===========================
|
||||
git:
|
||||
git: check-remote
|
||||
@echo "📦 Commit automático → Gitea"
|
||||
@git config user.name $(GIT_USER)
|
||||
@git config user.email $(GIT_EMAIL)
|
||||
@git rev-parse --abbrev-ref HEAD >/dev/null 2>&1 || true
|
||||
@git add -A
|
||||
@git commit -m "$(COMMIT_MSG)" || echo "Nenhuma modificação para commitar."
|
||||
@git commit -m "$$(echo "$(COMMIT_MSG)")" || echo "Nenhuma modificação para commitar."
|
||||
@git push $(GIT_REMOTE) $(GIT_BRANCH)
|
||||
|
||||
# ===========================
|
||||
# Release (Tarball)
|
||||
# ===========================
|
||||
release: tarball
|
||||
release: tarball check-remote
|
||||
@echo "🚀 Publicando build em dist/releases"
|
||||
@mkdir -p $(DIST_DIR)/releases
|
||||
@if ls $(DIST_DIR)/neoricalex-*.tar.gz >/dev/null 2>&1; then \
|
||||
@ -80,6 +80,33 @@ release: tarball
|
||||
git tag -a $$TAG -m "Release automática em $$TAG" && \
|
||||
git push origin $$TAG || echo "⚠️ Tag já existente ou erro ao criar."
|
||||
|
||||
# ===========================
|
||||
# Git Remote (HTTPS → SSH Auto-Fix)
|
||||
# ===========================
|
||||
check-remote:
|
||||
@REMOTE_URL=$$(git remote get-url $(GIT_REMOTE)); \
|
||||
if echo $$REMOTE_URL | grep -q '^https://gitea\.neoricalex\.com'; then \
|
||||
echo "⚠️ Repositório configurado com HTTPS:"; \
|
||||
echo " $$REMOTE_URL"; \
|
||||
echo "🔄 Convertendo para SSH (porta 2222)..."; \
|
||||
SSH_URL=$$(echo $$REMOTE_URL | sed -E 's|https://gitea\.neoricalex\.com[:/]+|ssh://git@gitea.neoricalex.com:2222/|'); \
|
||||
git remote set-url $(GIT_REMOTE) $$SSH_URL; \
|
||||
echo "✅ Remote atualizado para:"; \
|
||||
git remote -v; \
|
||||
else \
|
||||
echo "✅ Remote SSH já configurado:"; \
|
||||
git remote -v | grep $(GIT_REMOTE); \
|
||||
fi; \
|
||||
echo "🔍 Testando conectividade SSH com Gitea..."; \
|
||||
if ssh -T git@gitea.neoricalex.com -p 2222 2>&1 | grep -q "successfully authenticated"; then \
|
||||
echo "✅ Conexão SSH funcional com Gitea."; \
|
||||
else \
|
||||
echo "❌ Falha na autenticação SSH com Gitea."; \
|
||||
echo " Verifique a chave em ~/.ssh/id_ed25519.pub e nas SSH Keys do Gitea."; \
|
||||
exit 1; \
|
||||
fi
|
||||
|
||||
|
||||
# ===========================
|
||||
# Teste
|
||||
# ===========================
|
||||
|
||||
Loading…
Reference in New Issue
Block a user