From 32d82b1c68d4d914f83dc0aef70e731c53a07cf7 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 02:46:00 +0700 Subject: [PATCH 1/8] Add set_as_main option --- .github/workflows/4_bumper_repository.yml | 6 +- .github/workflows/5_bumper_repository.yml | 169 ++++++++++++++++++++++ tools/repository_bumper.sh | 61 +++++++- 3 files changed, 229 insertions(+), 7 deletions(-) create mode 100644 .github/workflows/5_bumper_repository.yml diff --git a/.github/workflows/4_bumper_repository.yml b/.github/workflows/4_bumper_repository.yml index a215726c..65981a8f 100644 --- a/.github/workflows/4_bumper_repository.yml +++ b/.github/workflows/4_bumper_repository.yml @@ -1,4 +1,4 @@ -name: Repository bumper +name: Repository bumper 4.x run-name: Bump ${{ github.ref_name }} (${{ inputs.id }}) on: @@ -30,8 +30,8 @@ on: jobs: bump: - name: Repository bumper - runs-on: ubuntu-22.04 + name: Repository bumper 4.x + runs-on: ubuntu-24.04 permissions: contents: write pull-requests: write diff --git a/.github/workflows/5_bumper_repository.yml b/.github/workflows/5_bumper_repository.yml new file mode 100644 index 00000000..055edfc1 --- /dev/null +++ b/.github/workflows/5_bumper_repository.yml @@ -0,0 +1,169 @@ +name: Repository bumper 5.x +run-name: Bump ${{ github.ref_name }} (${{ inputs.id }}) + +on: + workflow_dispatch: + inputs: + version: + description: 'Target version (e.g. 1.2.3)' + default: '' + required: false + type: string + stage: + description: 'Version stage (e.g. alpha0)' + default: '' + required: false + type: string + tag: + description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)' + default: false + required: false + type: boolean + set_as_main: + description: "Enable main branch mode: bump version values only, keep branch references pointing to main" + required: false + type: boolean + default: false + issue-link: + description: 'Issue link in format https://github.com/wazuh//issues/' + required: true + type: string + id: + description: 'Optional identifier for the run' + required: false + type: string + +jobs: + bump: + name: Repository bumper 5.x + runs-on: ubuntu-24.04 + permissions: + contents: write + pull-requests: write + + env: + CI_COMMIT_AUTHOR: wazuhci + CI_COMMIT_EMAIL: 22834044+wazuhci@users.noreply.github.com + CI_GPG_PRIVATE_KEY: ${{ secrets.CI_WAZUHCI_GPG_PRIVATE }} + GH_TOKEN: ${{ secrets.CI_WAZUHCI_BUMPER_TOKEN }} + BUMP_SCRIPT_PATH: tools/repository_bumper.sh + BUMP_LOG_PATH: tools + + steps: + - name: Dump event payload + run: | + cat $GITHUB_EVENT_PATH | jq '.inputs' + + - name: Set up GPG key + id: signing_setup + run: | + echo "${{ env.CI_GPG_PRIVATE_KEY }}" | gpg --batch --import + KEY_ID=$(gpg --list-secret-keys --with-colons | awk -F: '/^sec/ {print $5; exit}') + echo "gpg_key_id=$KEY_ID" >> $GITHUB_OUTPUT + + - name: Set up git + run: | + git config --global user.name "${{ env.CI_COMMIT_AUTHOR }}" + git config --global user.email "${{ env.CI_COMMIT_EMAIL }}" + git config --global commit.gpgsign true + git config --global user.signingkey "${{ steps.signing_setup.outputs.gpg_key_id }}" + echo "use-agent" >> ~/.gnupg/gpg.conf + echo "pinentry-mode loopback" >> ~/.gnupg/gpg.conf + echo "allow-loopback-pinentry" >> ~/.gnupg/gpg-agent.conf + echo RELOADAGENT | gpg-connect-agent + export DEBIAN_FRONTEND=noninteractive + export GPG_TTY=$(tty) + + - name: Checkout repository + uses: actions/checkout@v6 + with: + # Using workflow-specific GITHUB_TOKEN because currently CI_WAZUHCI_BUMPER_TOKEN + # doesn't have all the necessary permissions + token: ${{ env.GH_TOKEN }} + + - name: Determine branch name and script params + id: vars + env: + VERSION: ${{ inputs.version }} + STAGE: ${{ inputs.stage }} + TAG: ${{ inputs.tag }} + run: | + script_params="" + version=${{ env.VERSION }} + stage=${{ env.STAGE }} + tag=${{ env.TAG }} + set_as_main=${{ inputs.set_as_main }} + + # Both version and stage provided + if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then + script_params="--version ${version} --stage ${stage}" + elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then + script_params="--version ${version} --stage ${stage} --tag ${tag}" + fi + + if [[ "$set_as_main" == "true" ]]; then + script_params="${script_params} --set-as-main" + fi + + issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') + BRANCH_NAME="enhancement/wqa${issue_number}-bump-${{ github.ref_name }}" + echo "branch_name=$BRANCH_NAME" >> $GITHUB_OUTPUT + echo "script_params=${script_params}" >> $GITHUB_OUTPUT + + - name: Create and switch to bump branch + run: | + git checkout -b ${{ steps.vars.outputs.branch_name }} + + - name: Make version bump changes + run: | + echo "Running bump script" + bash ${{ env.BUMP_SCRIPT_PATH }} ${{ steps.vars.outputs.script_params }} + + - name: Check for file changes + id: changes + run: | + if git diff --quiet && git diff --cached --quiet; then + echo "No changes detected. Exiting cleanly." + echo "has_changes=false" >> $GITHUB_OUTPUT + else + echo "has_changes=true" >> $GITHUB_OUTPUT + fi + + - name: Commit and push changes + if: steps.changes.outputs.has_changes == 'true' + run: | + git add . + git commit -m "feat: bump ${{ github.ref_name }}" + git push origin ${{ steps.vars.outputs.branch_name }} + + - name: Create pull request + id: create_pr + if: steps.changes.outputs.has_changes == 'true' + run: | + gh auth setup-git + PR_URL=$(gh pr create \ + --title "Bump ${{ github.ref_name }} branch" \ + --body "Issue: ${{ inputs.issue-link }}" \ + --base ${{ github.ref_name }} \ + --head ${{ steps.vars.outputs.branch_name }}) + + echo "Pull request created: ${PR_URL}" + echo "pull_request_url=${PR_URL}" >> $GITHUB_OUTPUT + + - name: Merge pull request + if: steps.changes.outputs.has_changes == 'true' + run: | + # Any checks for the PR are bypassed since the branch is expected to be functional (i.e. the bump process does not introduce any bugs) + gh pr merge "${{ steps.create_pr.outputs.pull_request_url }}" --merge --admin + + - name: Show logs + run: | + echo "Bump complete." + if [[ "${{ steps.changes.outputs.has_changes }}" == "true" ]]; then + echo "Branch: ${{ steps.vars.outputs.branch_name }}" + echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}" + else + echo "No changes were made (no-op run)." + fi + echo "Bumper scripts logs:" + cat ${BUMP_LOG_PATH}/repository_bumper*log \ No newline at end of file diff --git a/tools/repository_bumper.sh b/tools/repository_bumper.sh index abf70f42..fc12e75c 100644 --- a/tools/repository_bumper.sh +++ b/tools/repository_bumper.sh @@ -10,7 +10,7 @@ LOG_FILE="${DIR}/tools/repository_bumper_$(date +"%Y-%m-%d_%H-%M-%S-%3N").log" VERSION="" STAGE="" FILES_EDITED=() -FILES_EXCLUDED='--exclude="repository_bumper_*.log" --exclude="CHANGELOG.md" --exclude="repository_bumper.sh" --exclude="*_bumper_repository.yml"' +FILES_EXCLUDED='--exclude="repository_bumper_*.log" --exclude="CHANGELOG.md" --exclude="repository_bumper.sh" --exclude="*_bumper_repository.yml" --exclude="mermaid-init.js" --exclude="mermaid.min.js"' get_old_version_and_stage() { local VERSION_FILE="${DIR}/VERSION.json" @@ -25,7 +25,7 @@ grep_command() { # This function is used to search for a specific string in the specified directory. # It takes two arguments: the string to search for and the directory to search in. # Usage: grep_command - eval grep -Rl "${1}" "${2}" --exclude-dir=".git" $FILES_EXCLUDED "${3}" + eval grep -Rl \"${1}\" \"${2}\" --exclude-dir=".git" $FILES_EXCLUDED "${3}" } update_version_in_files() { @@ -74,6 +74,46 @@ update_stage_in_files() { FILES_EDITED+=("${file}") fi done + + if [ $STAGE != "alpha0" ]; then + version_tag_string="default: 'v${VERSION}'" + files_tag=( $(grep_command "${version_tag_string}" "${DIR}") ) + for file in "${files_tag[@]}"; do + sed -i "s/${version_tag_string}/default: 'v${VERSION}-${STAGE}'/g" "${file}" + if [[ $(git diff --name-only "${file}") ]]; then + FILES_EDITED+=("${file}") + fi + done + + version_number_string="default: '${VERSION}'" + files_version=( $(grep -RlE "default: '[0-9]\.[0-9]+\.[0-9]+'" "${DIR}") ) + for file in "${files_version[@]}"; do + sed -i "s/${version_number_string}/default: 'v${VERSION}-${STAGE}'/g" "${file}" + if [[ $(git diff --name-only "${file}") ]]; then + FILES_EDITED+=("${file}") + fi + done + fi +} + +update_main_in_files() { + set -x + if [[ $STAGE == "alpha0" ]]; then + bump_string="default: '${VERSION}'" + else + bump_string="default: 'v${VERSION}'" + fi + main_string="default: 'main'" + files=( $(grep_command "${main_string}" "${DIR}") ) + for file in "${files[@]}"; do + if [[ "$skip_urls" != "yes" ]]; then + sed -Ei "s/${main_string}/${bump_string}/g" ${file} + fi + if [[ $(git diff --name-only "${file}") ]]; then + FILES_EDITED+=("${file}") + fi + done + set +x } update_docker_images_tag() { @@ -106,6 +146,10 @@ main() { TAG="$2" shift 2 ;; + --set-as-main) + set_as_main="yes" + shift 1 + ;; *) echo "Unknown argument: $1" exit 1 @@ -137,6 +181,15 @@ main() { exit 1 fi + # Set skip_urls variable based on set_as_main flag + if [[ -n "$set_as_main" ]]; then + skip_urls="yes" + else + skip_urls="no" + fi + echo "Updating version from main to $VERSION" | tee -a "${LOG_FILE}" + update_main_in_files "$VERSION" "$STAGE" + # Validate if tag is true or false if [[ -n "${TAG}" && ! "${TAG}" =~ ^(true|false)$ ]]; then echo "Error: --tag must be either true or false." | tee -a "${LOG_FILE}" @@ -150,9 +203,9 @@ main() { echo "Updating version from ${OLD_VERSION} to ${VERSION}" | tee -a "${LOG_FILE}" update_version_in_files "${VERSION}" fi - if [[ "${OLD_STAGE}" != "${STAGE}" ]]; then + if [[ -n "$STAGE" ]]; then echo "Updating stage from ${OLD_STAGE} to ${STAGE}" | tee -a "${LOG_FILE}" - update_stage_in_files "${STAGE}" + update_stage_in_files "$VERSION" "$STAGE" fi # Update Docker images tag if tag is true From ed29a8b11ac710eb5114d04325f5218954929179 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 03:12:31 +0700 Subject: [PATCH 2/8] Add changelog --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 889b3e7a..48e5846f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ All notable changes to this project will be documented in this file. ### Changed +- Add set_as_main option ([#2293](https://github.com/wazuh/wazuh-docker/pull/2293)) - Delete all API user and password references and Wazuh agent references ([#2289](https://github.com/wazuh/wazuh-docker/pull/2289)) - Create certificate directory with default user and group ([#2287](https://github.com/wazuh/wazuh-docker/pull/2287)) - Standarize Artifact URL keys ([#2286](https://github.com/wazuh/wazuh-docker/pull/2286)) From d8c238a8d1bc7c5aef5e9534e9234cc01399b70e Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 22:31:15 +0700 Subject: [PATCH 3/8] Delete set -x option --- tools/repository_bumper.sh | 27 +++++++++++---------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/tools/repository_bumper.sh b/tools/repository_bumper.sh index fc12e75c..32a4545d 100644 --- a/tools/repository_bumper.sh +++ b/tools/repository_bumper.sh @@ -30,29 +30,29 @@ grep_command() { update_version_in_files() { - local OLD_MAYOR="$(echo "${OLD_VERSION}" | cut -d '.' -f 1)" + local OLD_MAJOR="$(echo "${OLD_VERSION}" | cut -d '.' -f 1)" local OLD_MINOR="$(echo "${OLD_VERSION}" | cut -d '.' -f 2)" local OLD_PATCH="$(echo "${OLD_VERSION}" | cut -d '.' -f 3)" - local NEW_MAYOR="$(echo "${VERSION}" | cut -d '.' -f 1)" + local NEW_MAJOR="$(echo "${VERSION}" | cut -d '.' -f 1)" local NEW_MINOR="$(echo "${VERSION}" | cut -d '.' -f 2)" local NEW_PATCH="$(echo "${VERSION}" | cut -d '.' -f 3)" - m_m_p_files=( $(grep_command "${OLD_MAYOR}\.${OLD_MINOR}\.${OLD_PATCH}" "${DIR}") ) + m_m_p_files=( $(grep_command "${OLD_MAJOR}\.${OLD_MINOR}\.${OLD_PATCH}" "${DIR}") ) for file in "${m_m_p_files[@]}"; do - sed -i "s/\bv${OLD_MAYOR}\.${OLD_MINOR}\.${OLD_PATCH}\b/v${NEW_MAYOR}\.${NEW_MINOR}\.${NEW_PATCH}/g; s/\b${OLD_MAYOR}\.${OLD_MINOR}\.${OLD_PATCH}/${NEW_MAYOR}\.${NEW_MINOR}\.${NEW_PATCH}/g" "${file}" + sed -i "s/\bv${OLD_MAJOR}\.${OLD_MINOR}\.${OLD_PATCH}\b/v${NEW_MAJOR}\.${NEW_MINOR}\.${NEW_PATCH}/g; s/\b${OLD_MAJOR}\.${OLD_MINOR}\.${OLD_PATCH}/${NEW_MAJOR}\.${NEW_MINOR}\.${NEW_PATCH}/g" "${file}" if [[ $(git diff --name-only "${file}") ]]; then FILES_EDITED+=("${file}") fi done - m_m_files=( $(grep_command "${OLD_MAYOR}\.${OLD_MINOR}" "${DIR}") ) + m_m_files=( $(grep_command "${OLD_MAJOR}\.${OLD_MINOR}" "${DIR}") ) for file in "${m_m_files[@]}"; do - sed -i -E "/[0-9]+\.[0-9]+\.[0-9]+/! s/(^|[^0-9.])(${OLD_MAYOR}\.${OLD_MINOR})([^0-9.]|$)/\1${NEW_MAYOR}.${NEW_MINOR}\3/g" "$file" + sed -i -E "/[0-9]+\.[0-9]+\.[0-9]+/! s/(^|[^0-9.])(${OLD_MAJOR}\.${OLD_MINOR})([^0-9.]|$)/\1${NEW_MAJOR}.${NEW_MINOR}\3/g" "$file" if [[ $(git diff --name-only "${file}") ]]; then FILES_EDITED+=("${file}") fi done - m_x_files=( $(grep_command "${OLD_MAYOR}\.x" "${DIR}") ) + m_x_files=( $(grep_command "${OLD_MAJOR}\.x" "${DIR}") ) for file in "${m_x_files[@]}"; do - sed -i "s/\b${OLD_MAYOR}\.x\b/${NEW_MAYOR}\.x/g" "${file}" + sed -i "s/\b${OLD_MAJOR}\.x\b/${NEW_MAJOR}\.x/g" "${file}" if [[ $(git diff --name-only "${file}") ]]; then FILES_EDITED+=("${file}") fi @@ -97,7 +97,6 @@ update_stage_in_files() { } update_main_in_files() { - set -x if [[ $STAGE == "alpha0" ]]; then bump_string="default: '${VERSION}'" else @@ -113,7 +112,6 @@ update_main_in_files() { FILES_EDITED+=("${file}") fi done - set +x } update_docker_images_tag() { @@ -182,13 +180,10 @@ main() { fi # Set skip_urls variable based on set_as_main flag - if [[ -n "$set_as_main" ]]; then - skip_urls="yes" - else - skip_urls="no" + if [[ -z "$set_as_main" ]]; then + echo "Updating version from main to $VERSION" | tee -a "${LOG_FILE}" + update_main_in_files "$VERSION" "$STAGE" fi - echo "Updating version from main to $VERSION" | tee -a "${LOG_FILE}" - update_main_in_files "$VERSION" "$STAGE" # Validate if tag is true or false if [[ -n "${TAG}" && ! "${TAG}" =~ ^(true|false)$ ]]; then From 0465f44c14a335eb644bec06d129be7fdf6e45fc Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 22:40:52 +0700 Subject: [PATCH 4/8] Change main reference --- tools/repository_bumper.sh | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/tools/repository_bumper.sh b/tools/repository_bumper.sh index 32a4545d..4712761a 100644 --- a/tools/repository_bumper.sh +++ b/tools/repository_bumper.sh @@ -76,19 +76,19 @@ update_stage_in_files() { done if [ $STAGE != "alpha0" ]; then - version_tag_string="default: 'v${VERSION}'" + version_tag_string=": 'v${VERSION}'" files_tag=( $(grep_command "${version_tag_string}" "${DIR}") ) for file in "${files_tag[@]}"; do - sed -i "s/${version_tag_string}/default: 'v${VERSION}-${STAGE}'/g" "${file}" + sed -i -E "s/(: )'v${VERSION}'/\1'v${VERSION}-${STAGE}'/g" "${file}" if [[ $(git diff --name-only "${file}") ]]; then FILES_EDITED+=("${file}") fi done - version_number_string="default: '${VERSION}'" - files_version=( $(grep -RlE "default: '[0-9]\.[0-9]+\.[0-9]+'" "${DIR}") ) + version_number_string=": '${VERSION}'" + files_version=( $(grep -RlE ": '[0-9]\.[0-9]+\.[0-9]+'" "${DIR}") ) for file in "${files_version[@]}"; do - sed -i "s/${version_number_string}/default: 'v${VERSION}-${STAGE}'/g" "${file}" + sed -i -E "s/(: )'${VERSION}'/\1'v${VERSION}-${STAGE}'/g" "${file}" if [[ $(git diff --name-only "${file}") ]]; then FILES_EDITED+=("${file}") fi @@ -98,15 +98,15 @@ update_stage_in_files() { update_main_in_files() { if [[ $STAGE == "alpha0" ]]; then - bump_string="default: '${VERSION}'" + bump_value="${VERSION}" else - bump_string="default: 'v${VERSION}'" + bump_value="v${VERSION}" fi - main_string="default: 'main'" + main_string=": 'main'" files=( $(grep_command "${main_string}" "${DIR}") ) for file in "${files[@]}"; do if [[ "$skip_urls" != "yes" ]]; then - sed -Ei "s/${main_string}/${bump_string}/g" ${file} + sed -Ei "s/(:[[:space:]])'main'/\1'${bump_value}'/g" "${file}" fi if [[ $(git diff --name-only "${file}") ]]; then FILES_EDITED+=("${file}") From c8e04c1cfd903307104d685a86b251bbcab23826 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Tue, 14 Apr 2026 22:50:41 +0700 Subject: [PATCH 5/8] Change bumper workflows --- .github/workflows/4_bumper_repository.yml | 15 ++------ .github/workflows/5_bumper_repository.yml | 45 ++++++----------------- 2 files changed, 15 insertions(+), 45 deletions(-) diff --git a/.github/workflows/4_bumper_repository.yml b/.github/workflows/4_bumper_repository.yml index 65981a8f..591294fa 100644 --- a/.github/workflows/4_bumper_repository.yml +++ b/.github/workflows/4_bumper_repository.yml @@ -14,11 +14,6 @@ on: default: '' required: false type: string - tag: - description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)' - default: false - required: false - type: boolean issue-link: description: 'Issue link in format https://github.com/wazuh//issues/' required: true @@ -81,18 +76,16 @@ jobs: env: VERSION: ${{ inputs.version }} STAGE: ${{ inputs.stage }} - TAG: ${{ inputs.tag }} run: | script_params="" version=${{ env.VERSION }} stage=${{ env.STAGE }} - tag=${{ env.TAG }} # Both version and stage provided - if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then + if [[ -n "$version" && -n "$stage" ]]; then script_params="--version ${version} --stage ${stage}" - elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then - script_params="--version ${version} --stage ${stage} --tag ${tag}" + elif [[ -z "$version" && -n "$stage" ]]; then + script_params="--stage ${stage}" fi issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') @@ -139,4 +132,4 @@ jobs: echo "Branch: ${{ steps.vars.outputs.branch_name }}" echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}" echo "Bumper scripts logs:" - cat ${BUMP_LOG_PATH}/repository_bumper*log + cat ${BUMP_LOG_PATH}/repository_bumper*log \ No newline at end of file diff --git a/.github/workflows/5_bumper_repository.yml b/.github/workflows/5_bumper_repository.yml index 055edfc1..04985874 100644 --- a/.github/workflows/5_bumper_repository.yml +++ b/.github/workflows/5_bumper_repository.yml @@ -14,11 +14,6 @@ on: default: '' required: false type: string - tag: - description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)' - default: false - required: false - type: boolean set_as_main: description: "Enable main branch mode: bump version values only, keep branch references pointing to main" required: false @@ -81,28 +76,27 @@ jobs: # doesn't have all the necessary permissions token: ${{ env.GH_TOKEN }} - - name: Determine branch name and script params + - name: Determine branch name id: vars env: VERSION: ${{ inputs.version }} STAGE: ${{ inputs.stage }} - TAG: ${{ inputs.tag }} run: | script_params="" version=${{ env.VERSION }} stage=${{ env.STAGE }} - tag=${{ env.TAG }} + set_as_main=${{ inputs.set_as_main }} - # Both version and stage provided - if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then - script_params="--version ${version} --stage ${stage}" - elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then - script_params="--version ${version} --stage ${stage} --tag ${tag}" + if [[ "$set_as_main" == "true" ]]; then + script_params="--set-as-main" fi - if [[ "$set_as_main" == "true" ]]; then - script_params="${script_params} --set-as-main" + # Both version and stage provided + if [[ -n "$version" && -n "$stage" ]]; then + script_params+=" --version ${version} --stage ${stage}" + elif [[ -z "$version" && -n "$stage" ]]; then + script_params+=" --stage ${stage}" fi issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') @@ -119,18 +113,7 @@ jobs: echo "Running bump script" bash ${{ env.BUMP_SCRIPT_PATH }} ${{ steps.vars.outputs.script_params }} - - name: Check for file changes - id: changes - run: | - if git diff --quiet && git diff --cached --quiet; then - echo "No changes detected. Exiting cleanly." - echo "has_changes=false" >> $GITHUB_OUTPUT - else - echo "has_changes=true" >> $GITHUB_OUTPUT - fi - - name: Commit and push changes - if: steps.changes.outputs.has_changes == 'true' run: | git add . git commit -m "feat: bump ${{ github.ref_name }}" @@ -138,7 +121,6 @@ jobs: - name: Create pull request id: create_pr - if: steps.changes.outputs.has_changes == 'true' run: | gh auth setup-git PR_URL=$(gh pr create \ @@ -151,7 +133,6 @@ jobs: echo "pull_request_url=${PR_URL}" >> $GITHUB_OUTPUT - name: Merge pull request - if: steps.changes.outputs.has_changes == 'true' run: | # Any checks for the PR are bypassed since the branch is expected to be functional (i.e. the bump process does not introduce any bugs) gh pr merge "${{ steps.create_pr.outputs.pull_request_url }}" --merge --admin @@ -159,11 +140,7 @@ jobs: - name: Show logs run: | echo "Bump complete." - if [[ "${{ steps.changes.outputs.has_changes }}" == "true" ]]; then - echo "Branch: ${{ steps.vars.outputs.branch_name }}" - echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}" - else - echo "No changes were made (no-op run)." - fi + echo "Branch: ${{ steps.vars.outputs.branch_name }}" + echo "PR: ${{ steps.create_pr.outputs.pull_request_url }}" echo "Bumper scripts logs:" cat ${BUMP_LOG_PATH}/repository_bumper*log \ No newline at end of file From dc7d56e7fff58f577e0a6899374286792fc67c7f Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Wed, 15 Apr 2026 02:50:58 +0700 Subject: [PATCH 6/8] Add tag input --- .github/workflows/4_bumper_repository.yml | 13 ++++++++++--- .github/workflows/5_bumper_repository.yml | 16 +++++++++++----- 2 files changed, 21 insertions(+), 8 deletions(-) diff --git a/.github/workflows/4_bumper_repository.yml b/.github/workflows/4_bumper_repository.yml index 591294fa..c932fc35 100644 --- a/.github/workflows/4_bumper_repository.yml +++ b/.github/workflows/4_bumper_repository.yml @@ -14,6 +14,11 @@ on: default: '' required: false type: string + tag: + description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)' + default: false + required: false + type: boolean issue-link: description: 'Issue link in format https://github.com/wazuh//issues/' required: true @@ -76,16 +81,18 @@ jobs: env: VERSION: ${{ inputs.version }} STAGE: ${{ inputs.stage }} + TAG: ${{ inputs.tag }} run: | script_params="" version=${{ env.VERSION }} stage=${{ env.STAGE }} + tag=${{ env.TAG }} # Both version and stage provided - if [[ -n "$version" && -n "$stage" ]]; then + if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then script_params="--version ${version} --stage ${stage}" - elif [[ -z "$version" && -n "$stage" ]]; then - script_params="--stage ${stage}" + elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then + script_params="--version ${version} --stage ${stage} --tag ${tag}" fi issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') diff --git a/.github/workflows/5_bumper_repository.yml b/.github/workflows/5_bumper_repository.yml index 04985874..10514900 100644 --- a/.github/workflows/5_bumper_repository.yml +++ b/.github/workflows/5_bumper_repository.yml @@ -14,6 +14,11 @@ on: default: '' required: false type: string + tag: + description: 'Change branches references to tag-like references (e.g. v4.12.0-alpha7)' + default: false + required: false + type: boolean set_as_main: description: "Enable main branch mode: bump version values only, keep branch references pointing to main" required: false @@ -81,10 +86,12 @@ jobs: env: VERSION: ${{ inputs.version }} STAGE: ${{ inputs.stage }} + TAG: ${{ inputs.tag }} run: | script_params="" version=${{ env.VERSION }} stage=${{ env.STAGE }} + tag=${{ env.TAG }} set_as_main=${{ inputs.set_as_main }} @@ -93,11 +100,10 @@ jobs: fi # Both version and stage provided - if [[ -n "$version" && -n "$stage" ]]; then - script_params+=" --version ${version} --stage ${stage}" - elif [[ -z "$version" && -n "$stage" ]]; then - script_params+=" --stage ${stage}" - fi + if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then + script_params="--version ${version} --stage ${stage}" + elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then + script_params="--version ${version} --stage ${stage} --tag ${tag}" issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') BRANCH_NAME="enhancement/wqa${issue_number}-bump-${{ github.ref_name }}" From 1331bd3870d248fb63c4978077e4341b8baa8e56 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Wed, 15 Apr 2026 03:04:08 +0700 Subject: [PATCH 7/8] Add tag input --- .github/workflows/5_bumper_repository.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/5_bumper_repository.yml b/.github/workflows/5_bumper_repository.yml index 10514900..56578c6a 100644 --- a/.github/workflows/5_bumper_repository.yml +++ b/.github/workflows/5_bumper_repository.yml @@ -104,6 +104,7 @@ jobs: script_params="--version ${version} --stage ${stage}" elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then script_params="--version ${version} --stage ${stage} --tag ${tag}" + fi issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}') BRANCH_NAME="enhancement/wqa${issue_number}-bump-${{ github.ref_name }}" From 84612f5231cb41dc17f5ac4d0682b419211adaf4 Mon Sep 17 00:00:00 2001 From: Victor Carlos Erenu Date: Wed, 15 Apr 2026 03:13:05 +0700 Subject: [PATCH 8/8] Add tag input --- .github/workflows/5_bumper_repository.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/5_bumper_repository.yml b/.github/workflows/5_bumper_repository.yml index 56578c6a..39464ad7 100644 --- a/.github/workflows/5_bumper_repository.yml +++ b/.github/workflows/5_bumper_repository.yml @@ -101,9 +101,9 @@ jobs: # Both version and stage provided if [[ -n "$version" && -n "$stage" && "$tag" != "true" ]]; then - script_params="--version ${version} --stage ${stage}" + script_params+=" --version ${version} --stage ${stage}" elif [[ -n "$version" && -n "$stage" && "$tag" == "true" ]]; then - script_params="--version ${version} --stage ${stage} --tag ${tag}" + script_params+=" --version ${version} --stage ${stage} --tag ${tag}" fi issue_number=$(echo "${{ inputs.issue-link }}" | awk -F'/' '{print $NF}')