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