Change bumper workflows

This commit is contained in:
Victor Carlos Erenu
2026-04-14 22:50:41 +07:00
parent 0465f44c14
commit c8e04c1cfd
2 changed files with 15 additions and 45 deletions
+4 -11
View File
@@ -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/<REPO>/issues/<ISSUE-NUMBER>'
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
+11 -34
View File
@@ -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