Pular para conteúdo

GIT_PUSH_TAGS - Enviar Tags para Repositório Remoto

O que é este Node?

O GIT_PUSH_TAGS é o node responsável por enviar todas as tags locais para o repositório remoto. Ele executa o comando git push --tags.

Por que este Node existe?

Tags criadas localmente precisam ser enviadas ao remoto para serem compartilhadas. O GIT_PUSH_TAGS existe para:

  1. Compartilhamento: Disponibilizar tags para toda a equipe
  2. Backup: Garantir tags no servidor remoto
  3. CI/CD: Trigger pipelines baseados em tags
  4. Releases: Publicar releases marcadas com tags

Como funciona internamente?

Quando o GIT_PUSH_TAGS é executado, o sistema:

  1. Valida repositório: Verifica se é repositório Git válido
  2. Executa push: Roda git push --tags
  3. Envia todas tags: Todas tags locais são enviadas
  4. Retorna confirmação: Confirma envio das tags

Código interno (git.executor.ts:170-173):

private async pushTags(repoPath: string, context: ExecutionContext): Promise<any> {
  const output = await this.execGit(repoPath, 'push --tags', context);
  return { output, tagsPushed: true };
}

Quando você DEVE usar este Node?

Use GIT_PUSH_TAGS quando precisar de compartilhar tags com repositório remoto:

Casos de uso

  1. Release publishing: "Publicar tag de release no GitHub"
  2. Team sync: "Compartilhar tags com equipe"
  3. CI/CD trigger: "Acionar deploy baseado em tag"
  4. Backup: "Garantir tags no servidor remoto"

Quando NÃO usar GIT_PUSH_TAGS

  • Sem tags locais: Não há tags para enviar
  • Tags já enviadas: Verificar antes para evitar conflito

Parâmetros

Campo Tipo Obrigatório Descrição
operation string Sim Deve ser "pushTags"
repositoryPath string Sim Caminho do repositório local
responseVariable string Não Variável para armazenar resultado

Exemplo 1: Release Completa com Push de Tags

Objetivo: Criar tag de release e enviar ao remoto

JSON para Importar

{
  "name": "Release Completa",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "input_1",
      "type": "input",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Versão",
        "parameters": {
          "message": "Digite a versão da release:",
          "variable": "release_version"
        }
      }
    },
    {
      "id": "git_tag_1",
      "type": "git",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Create Tag",
        "operation": "createTag",
        "repositoryPath": "/var/www/production",
        "tagName": "v{{release_version}}",
        "tagMessage": "Release v{{release_version}}",
        "responseVariable": "tag_result"
      }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Tag Criada",
        "parameters": {
          "message": "Tag {{tag_result.tagName}} criada. Enviando ao remoto..."
        }
      }
    },
    {
      "id": "git_push_tags_1",
      "type": "git",
      "position": { "x": 900, "y": 100 },
      "data": {
        "label": "Push Tags",
        "operation": "pushTags",
        "repositoryPath": "/var/www/production",
        "responseVariable": "push_result"
      }
    },
    {
      "id": "message_2",
      "type": "message",
      "position": { "x": 1100, "y": 100 },
      "data": {
        "label": "Sucesso",
        "parameters": {
          "message": "Release v{{release_version}} publicada com sucesso!\nTags enviadas ao repositório remoto."
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1300, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "input_1" },
    { "source": "input_1", "target": "git_tag_1" },
    { "source": "git_tag_1", "target": "message_1" },
    { "source": "message_1", "target": "git_push_tags_1" },
    { "source": "git_push_tags_1", "target": "message_2" },
    { "source": "message_2", "target": "end_1" }
  ]
}

Saída esperada:

Usuário: 2.1.0
Sistema: Tag v2.1.0 criada. Enviando ao remoto...
Sistema: Release v2.1.0 publicada com sucesso!
Tags enviadas ao repositório remoto.

Exemplo 2: Backup de Tags

Objetivo: Enviar todas tags locais como backup

JSON para Importar

{
  "name": "Backup de Tags",
  "nodes": [
    {
      "id": "start_1",
      "type": "start",
      "position": { "x": 100, "y": 100 },
      "data": { "label": "Início" }
    },
    {
      "id": "message_1",
      "type": "message",
      "position": { "x": 300, "y": 100 },
      "data": {
        "label": "Aviso",
        "parameters": {
          "message": "Iniciando backup de tags..."
        }
      }
    },
    {
      "id": "git_push_tags_1",
      "type": "git",
      "position": { "x": 500, "y": 100 },
      "data": {
        "label": "Push All Tags",
        "operation": "pushTags",
        "repositoryPath": "/var/www/app",
        "responseVariable": "push_result"
      }
    },
    {
      "id": "condition_1",
      "type": "condition",
      "position": { "x": 700, "y": 100 },
      "data": {
        "label": "Verificar Sucesso",
        "parameters": {
          "condition": "{{push_result.tagsPushed}} === true"
        }
      }
    },
    {
      "id": "message_success",
      "type": "message",
      "position": { "x": 900, "y": 50 },
      "data": {
        "label": "Sucesso",
        "parameters": {
          "message": "Todas as tags foram enviadas com sucesso!"
        }
      }
    },
    {
      "id": "message_error",
      "type": "message",
      "position": { "x": 900, "y": 150 },
      "data": {
        "label": "Erro",
        "parameters": {
          "message": "Falha ao enviar tags"
        }
      }
    },
    {
      "id": "end_1",
      "type": "end",
      "position": { "x": 1100, "y": 100 },
      "data": { "label": "Fim" }
    }
  ],
  "edges": [
    { "source": "start_1", "target": "message_1" },
    { "source": "message_1", "target": "git_push_tags_1" },
    { "source": "git_push_tags_1", "target": "condition_1" },
    { "source": "condition_1", "target": "message_success", "label": "true" },
    { "source": "condition_1", "target": "message_error", "label": "false" },
    { "source": "message_success", "target": "end_1" },
    { "source": "message_error", "target": "end_1" }
  ]
}

Resposta do Node

{
  "output": "To github.com:user/repo.git\n * [new tag]         v1.0.0 -> v1.0.0\n * [new tag]         v1.1.0 -> v1.1.0",
  "tagsPushed": true
}

Boas Práticas

SIM: - Sempre push tags após criar release tag - Verifique conexão antes de push - Use após GIT_CREATE_TAG - Valide sucesso com responseVariable

NÃO: - Não faça push de tags não testadas - Não delete tags remotas sem comunicar equipe - Não force push tags sem necessidade

Dicas

💡 Dica 1: Use após GIT_CREATE_TAG para completar release

💡 Dica 2: Comando envia TODAS as tags locais não enviadas

💡 Dica 3: Combine com WEBHOOK para notificar equipe

💡 Dica 4: Tags remotas ativam pipelines CI/CD no GitHub/GitLab

Próximo Node

GIT_CREATE_TAG - Criar tag antes de push → GIT_PUSH - Enviar commits ao remoto