.github/workflows/update-to-latest.yaml #105
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'Dockerfile' | |
workflow_dispatch: | |
jobs: | |
n8n_latest_release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: update addon configuration in config.json | |
run: | | |
actual_config=$(cat config.json | jq -r ".version" | awk -F"." '{print $3}') | |
new_config=$((actual_config+1)) | |
actual_version=$(cat config.json | jq -r ".version" | awk -F"." '{print $1"."$2}') | |
new_version="${actual_version}.${new_config}" | |
jq ".version = \"${new_version}\"" config.json > config.json.tmp && mv config.json.tmp config.json | |
n8n_version=$(cat Dockerfile | grep "FROM" | awk -F":" '{print $2}') | |
sed -i "s/## \[Unreleased\]/## \[Unreleased\]\n\n## [ ${new_version} ] - $(date +%Y-%m-%d) \n\n Bump n8n to ${n8n_version} /g" CHANGELOG.md | |
- name: create pull request | |
if: steps.check_update.outputs.update_needed == 'true' | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
token: ${{ secrets.CR_PAT }} | |
commit-message: Update n8n to ${{ steps.n8n_latest_version.outputs.latest_release }} | |
title: Update n8n to ${{ steps.n8n_latest_version.outputs.latest_release }} | |
body: | | |
Update n8n to ${{ steps.n8n_latest_version.outputs.latest_release }} | |
branch: update-n8n-${{ steps.n8n_latest_version.outputs.latest_release }} | |
labels: | | |
n8n | |
update |