{
  "id": "6XYqPkPDbHsRoX62",
  "meta": {
    "templateCredsSetupCompleted": true
  },
  "name": "update n8n version",
  "tags": [],
  "nodes": [
    {
      "id": "47829c66-4f79-43f1-a89f-a2137c86bb30",
      "name": "Get Local n8n version",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -180,
        -260
      ],
      "parameters": {
        "url": "http://0.0.0.0:5678/rest/settings",
        "options": {},
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBearerAuth"
      },
      "credentials": {
        "httpBearerAuth": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 4.2
    },
    {
      "id": "ee7a6dea-7b56-432c-9b8f-6ebd806e1359",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        -620,
        -260
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "triggerAtHour": 5
            }
          ]
        }
      },
      "typeVersion": 1.2
    },
    {
      "id": "5e64e00f-0403-4669-b9a1-c1fc93a28d47",
      "name": "SSH1",
      "type": "n8n-nodes-base.ssh",
      "position": [
        340,
        -260
      ],
      "parameters": {
        "cwd": "n8n/",
        "command": "=echo \"{{ $prevNode.outputIndex ? false : true }}\" > check_update.txt"
      },
      "credentials": {
        "sshPassword": {
          "name": "<your credential>"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "a40311c9-17b1-41e8-87d5-d86cce2439d7",
      "name": "Get the latest n8n version",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        -400,
        -260
      ],
      "parameters": {
        "url": "https://registry.npmjs.org/n8n/latest",
        "options": {
          "fullResponse": false
        }
      },
      "typeVersion": 2
    },
    {
      "id": "50d7a87c-4e1c-469b-b5ae-2d7347f7ca58",
      "name": "If",
      "type": "n8n-nodes-base.if",
      "position": [
        40,
        -260
      ],
      "parameters": {
        "options": {},
        "conditions": {
          "options": {
            "version": 2,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "a2d169a3-7aa2-46f5-bdb2-f0d53a011b5c",
              "operator": {
                "type": "string",
                "operation": "notEquals"
              },
              "leftValue": "={{ $('Get the latest n8n version').item.json.version }}",
              "rightValue": "={{ $json.data.versionCli }}"
            }
          ]
        }
      },
      "typeVersion": 2.2,
      "alwaysOutputData": false
    }
  ],
  "active": true,
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "0b55007a-a4cc-45ca-90a1-8cc4e17b0f1e",
  "connections": {
    "If": {
      "main": [
        [
          {
            "node": "SSH1",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "SSH1",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Get the latest n8n version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get Local n8n version": {
      "main": [
        [
          {
            "node": "If",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Get the latest n8n version": {
      "main": [
        [
          {
            "node": "Get Local n8n version",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}