Skip to main content

Automatically update n8n version

Workflow preview

Workflow preview
100%
Automatically update n8n version preview
Open on n8n.io

Important notice

This workflow is provided as-is. Please review and test before using in production.

1. Workflow Overview

n8n Workflow: Check and Update n8n Version This workflow automatically checks if the local n8n version is outdated and, if so, creates a file to signal an update is needed . ️ Working Environm...

Best for

  • DevOps automation workflows
  • intermediate n8n builders looking for reusable templates

Tools used

n8n-nodes-base.httprequest, n8n-nodes-base.scheduletrigger, n8n-nodes-base.ssh, n8n-nodes-base.if

Source and attribution

This workflow is cataloged by N8N Workflows and links back to its original n8n.io source page by Weilun.

Original n8n.io source

1.1 Workflow description

Title
Automatically update n8n version
Workflow name
Automatically update n8n version

πŸ”„ n8n Workflow: Check and Update n8n Version

This workflow automatically checks if the local n8n version is outdated and, if so, creates a file to signal an update is needed.


πŸ–₯️ Working Environment

  • Operating System: Ubuntu 24.04
  • n8n Installation: Docker container

πŸ“ Project Directory Structure

n8n/ β”œβ”€β”€ check_update.txt β”œβ”€β”€ check-update.sh β”œβ”€β”€ compose.yml β”œβ”€β”€ update_n8n.cron


🧾 File Descriptions

check_update.txt

Contains a single word:

  • true: Update is needed
  • false: No update required

check-update.sh

#!/bin/bash
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin

if grep -q "true" /home/sysadmin/n8n/check_update.txt; then
    # Place your update logic here
    echo "Update needed - please insert update logic"
    echo true > /home/sysadmin/n8n/check_update.txt
fi

Purpose:

  • Checks the contents of check_update.txt
  • If it contains true, executes update logic (currently a placeholder)
  • Resets check_update.txt to true

update_n8n.cron

SHELL=/bin/sh
10 5 * * * /bin/sh /home/sysadmin/n8n/check-update.sh

Purpose:

  • Runs the check-update.sh script daily at 5:10 AM
  • Uses /bin/sh as the shell environment

🧩 n8n Workflow Breakdown

1. Schedule Trigger πŸ•“

  • Purpose: Triggers the workflow every day at 5:00 AM
  • Node Type: Schedule Trigger

2. Get the latest n8n version 🌐

  • Purpose: Fetches the latest version of n8n from npm
  • Endpoint: https://registry.npmjs.org/n8n/latest
  • Node Type: HTTP Request

3. Get Local n8n version πŸ–₯️

  • Purpose: Retrieves the currently running n8n version
  • Endpoint: http://192.168.100.18:5678/rest/settings
  • Node Type: HTTP Request

4. If πŸ”

  • Purpose: Compares the local and latest versions
  • Condition: If not equal β†’ update is needed

5. SSH1 🧾

  • Purpose: Writes the result to a file on the host via SSH
  • Logic:
echo "{{ $('If').params.conditions ? 'false' : 'true' }}" > check_update.txt

Effect: Updates check_update.txt with "true" if an update is needed, "false" otherwise.

πŸ› οΈ Setting up Crontab on Ubuntu

1. Register the cron job with:

crontab update_n8n.cron

2. Verify that your cron job is registered:

crontab -l

βœ… Result

  • 5:00 AM – n8n workflow checks versions and writes result to check_update.txt
  • 5:10 AM – Cron runs check-update.sh to respond to update flag

1.2 Logical Blocks

This catalog entry is organized from the workflow JSON. The node-level section below shows the executable blocks available for review before importing the template.

2. Block-by-Block Analysis

Block 1 - Get Local n8n version

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 4.2

Block 2 - Schedule Trigger

Type / Role
n8n-nodes-base.scheduleTrigger - scheduleTrigger
Config choices
Version 1.2

Block 3 - SSH1

Type / Role
n8n-nodes-base.ssh - ssh
Config choices
Version 1

Block 4 - Get the latest n8n version

Type / Role
n8n-nodes-base.httpRequest - httpRequest
Config choices
Version 2

Block 5 - If

Type / Role
n8n-nodes-base.if - if
Config choices
Version 2.2

3. Summary Table

Workflow Automatically update n8n version
Complexity intermediate
Nodes 5
Categories DevOps
Author Weilun
Published 23 May 2025

4. Reproducing the Workflow from Scratch

  1. 1. Download the workflow JSON

    Use the JSON export at /data/workflows/4335/4335.json as the source template for this automation.

  2. 2. Import the template into n8n

    Open n8n, import the downloaded JSON, and review each node before activating the workflow.

  3. 3. Configure credentials and variables

    Replace placeholder credentials, API keys, webhook URLs, account IDs, and environment-specific values with your own settings.

  4. 4. Test with sample data

    Run the workflow manually or in a staging workspace, inspect node output, and confirm downstream systems receive the expected data.

  5. 5. Activate and monitor

    Enable the workflow only after testing, then monitor executions, errors, and rate limits during the first production runs.

5. General Notes & Resources

Review imported nodes carefully before activation. This catalog entry is intended to help you inspect the workflow structure, understand required services, and find related templates faster.

Node names, credentials, schedules, webhook paths, and external service limits may need adjustment for your workspace.

Frequently asked questions

What does Automatically update n8n version do?

n8n Workflow: Check and Update n8n Version This workflow automatically checks if the local n8n version is outdated and, if so, creates a file to signal an update is needed . ️ Working Environm...

What do I need before importing this workflow?

Review the workflow JSON, configure any required credentials in n8n, and test the automation in a safe workspace before using it in production.

Can I customize this workflow?

Yes. Use the block-by-block analysis and the downloadable JSON to inspect each node, then adjust credentials, prompts, schedules, filters, or destinations for your DevOps use case.