From 6ccee1df376122dd0df92d5e533c3070810ee7d6 Mon Sep 17 00:00:00 2001 From: a5r0n <32464596+a5r0n@users.noreply.github.com> Date: Thu, 17 Oct 2024 21:30:27 +0300 Subject: [PATCH] Add new CI version bump workflow and update README * **.github/workflows/ci-version-bump.yml** - Replace Node.js setup with Python setup - Install semver using pip - Use Python and semver for version bumping instead of npm * **README.md** - Add instructions for the new CI version bump workflow --- .github/workflows/ci-version-bump.yml | 15 ++++++++------- README.md | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci-version-bump.yml b/.github/workflows/ci-version-bump.yml index 2a35452..b9d8659 100644 --- a/.github/workflows/ci-version-bump.yml +++ b/.github/workflows/ci-version-bump.yml @@ -15,13 +15,14 @@ jobs: - name: Checkout code uses: actions/checkout@v4 - - name: Set up Node.js - uses: actions/setup-node@v3 + - name: Set up Python + uses: actions/setup-python@v2 with: - node-version: '14' + python-version: '3.x' - - name: Install dependencies - run: npm install + - name: Install semver + run: | + pip install semver - name: Bump version id: bump-version @@ -30,9 +31,9 @@ jobs: N8N_VERSION=$(grep -oP '^appVersion: "\K.*(?=")' n8n/Chart.yaml) TEMPLATE_CHANGED=$(git diff --name-only HEAD~1 HEAD | grep -E 'n8n/templates/.*\.yaml' || true) if [[ $TEMPLATE_CHANGED ]]; then - NEW_VERSION=$(npm version minor --no-git-tag-version) + NEW_VERSION=$(python -c "import semver; print(semver.VersionInfo.parse('$CURRENT_VERSION').bump_minor())") else - NEW_VERSION=$(npm version patch --no-git-tag-version) + NEW_VERSION=$(python -c "import semver; print(semver.VersionInfo.parse('$CURRENT_VERSION').bump_patch())") fi echo "New version: $NEW_VERSION" sed -i "s/^version: .*/version: $NEW_VERSION/" n8n/Chart.yaml diff --git a/README.md b/README.md index 0a4fe8a..77b9150 100644 --- a/README.md +++ b/README.md @@ -45,3 +45,21 @@ ingress: ``` see [values.yaml](./n8n/values.yaml) + +## CI Version Bump Workflow + +A new workflow has been added to automate chart version bump and release. The workflow is defined in the `.github/workflows/ci-version-bump.yml` file and performs the following actions: + +* Bumps patch version on n8n major/minor and patch for n8n patch versions. +* Bumps minor version for template changes. + +The workflow is triggered on push and pull request events to the `main` branch. It performs the following steps: + +1. Checks out the code. +2. Sets up Node.js environment. +3. Installs dependencies. +4. Bumps the chart version based on changes. +5. Commits the changes. +6. Creates a release. + +The version bumping is done for the Helm chart version, not for a Node.js package.