Skip to content

Auto update n8n

Auto update n8n #17

Workflow file for this run

name: Auto update n8n
on:
schedule:
- cron: '7 0 * * 1-5'
timezone: 'America/Chicago'
workflow_dispatch:
concurrency:
group: ${{ github.workflow }}
jobs:
update:
permissions:
actions: write
contents: write
runs-on: ubuntu-slim
steps:
- name: Checkout repository
uses: actions/checkout@v6
- name: Get n8n latest version
id: n8n
run: |
version=$(gh api repos/n8n-io/n8n/releases?per_page=10 -q 'map(select(.tag_name != null and .prerelease == false and (.tag_name | startswith("n8n@2."))))[0].tag_name')
if [[ "$version" != *"n8n@2"* ]]; then exit 1; fi
echo version=${version#n8n@} >> $GITHUB_OUTPUT
env:
GITHUB_TOKEN: ${{ github.token }}
- name: Update n8n version
run: sed -i -E "s|(n8nio/n8n:)([0-9]+\\.[0-9]+\\.[0-9]+)|\1$version|" fly.toml
env:
version: ${{ steps.n8n.outputs.version }}
- name: Add and commit fly.toml
id: add-and-commit
uses: EndBug/add-and-commit@v10
with:
add: fly.toml
default_author: github_actions
message: 'chore: Update n8n to ${{ steps.n8n.outputs.version }}'
- name: Deploy to fly.io
if: steps.add-and-commit.outputs.committed == 'true'
run: gh workflow run deploy.yaml
env:
GITHUB_TOKEN: ${{ github.token }}