Skip to content

Conversation

@gionn
Copy link
Member

@gionn gionn commented Dec 5, 2025

Checklist

Description

This pull request refactors the release workflow to use a new reusable workflow, making the release process more modular, configurable, and easier to maintain. The versioning is now handled via PR labels.

@gionn gionn marked this pull request as ready for review December 5, 2025 16:50
@gionn gionn requested a review from a team as a code owner December 5, 2025 16:50
@gionn gionn requested review from a team, alxgomz, Copilot, ffjdm, pmacius and siddavamshi4 December 5, 2025 16:50
Copilot finished reviewing on behalf of gionn December 5, 2025 16:55
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR introduces a major refactoring of the release workflow, transitioning from a version.txt-based versioning system to a PR label-based approach. The new system automatically determines version bumps (release/major, release/minor, or release/patch) from PR labels, calculates the new semantic version, executes an optional release script, and creates GitHub releases.

  • Removes version.txt file and associated manual version management
  • Adds new reusable workflow reusable-release.yml for automated version bumping and release creation
  • Refactors release.yml to use the new reusable workflow
  • Updates release.sh to accept both current and next version as parameters
  • Updates documentation and coding guidelines to reflect the label-based release process

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 6 comments.

Show a summary per file
File Description
version.txt Removed - versioning now handled via PR labels and git tags
docs/README.md Added documentation for new reusable-release workflow and updated release process instructions
.github/workflows/reusable-release.yml New reusable workflow that parses PR labels, calculates semantic versions, and creates releases
.github/workflows/release.yml Refactored to use the new reusable workflow with label-based or manual version selection
.github/scripts/release.sh Updated to accept both new and current version parameters for reference updates
.github/copilot-instructions.md Updated guidelines to reflect label-based release process instead of version.txt
Comments suppressed due to low confidence (1)

.github/scripts/release.sh:25

  • Potential issue with grep -Rl when no files match the pattern. If there are no files containing the pattern Alfresco/alfresco-build-tools.*@$CURRENT_VERSION, grep -Rl will return a non-zero exit code, causing the script to fail due to set -e. Consider adding a fallback or using grep -Rl ... || true to handle cases where no files match (e.g., first release or all references already updated).

release:
name: Release
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch'
uses: Alfresco/alfresco-build-tools/.github/workflows/[email protected]
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation example shows usage with version tag @v10.3.0, but according to the custom guideline, when referencing internal actions in workflow YAML files, you should use the latest released tag. Since this PR is proposing a major version bump (indicated by the checkbox in the PR description), the current latest would be v10.4.0, not v10.3.0.

However, per the guidelines, you should not update this reference to the next release version in the PR itself, as the tag will only exist after the release. This should use the current latest released tag, which appears to be v10.4.0 based on the version.txt content in the main branch.

Copilot generated this review using guidance from repository custom instructions.

Bump version defined in [version.txt](/version.txt) during a PR, release
workflow is triggered automatically on PR close.
Add a label to the PR among `major`, `minor`, or `patch` to trigger a release
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Inconsistent label format in documentation. The reusable workflow looks for labels with the release/ prefix (release/major, release/minor, release/patch), but the documentation here states "Add a label to the PR among major, minor, or patch" without the prefix. This should be updated to match the actual implementation: "Add a label to the PR among release/major, release/minor, or release/patch".

Suggested change
Add a label to the PR among `major`, `minor`, or `patch` to trigger a release
Add a label to the PR among `release/major`, `release/minor`, or `release/patch` to trigger a release

Copilot uses AI. Check for mistakes.
Comment on lines +123 to +124
commit_user_name: ${{ inputs.commit_username }}
commit_user_email: ${{ inputs.commit_email }}
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The commit username and email inputs are optional but are used unconditionally in the git-auto-commit-action. If these inputs are not provided, the action will receive empty values which may cause issues with git commits. Consider either making these inputs required, providing default values, or conditionally using the action only when both username and email are provided.

Copilot uses AI. Check for mistakes.
- name: Run optional release script
if: steps.set-release-level.outputs.release-level != '' && inputs.release_script != ''
run: |
${{ inputs.release_script }} "${{ steps.bump-semver.outputs.new-version }}" "${{ steps.bump-semver.outputs.current-version }}"
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two issues with the release script execution:

  1. Security: The release script path is passed directly to the shell without validation. Consider adding validation to ensure the script path starts with a safe prefix (e.g., ./.github/scripts/) to prevent execution of arbitrary scripts.

  2. Execution permissions: The script is executed directly without ensuring it has execute permissions. Consider using bash ${{ inputs.release_script }} ... instead of direct execution to avoid permission issues and improve portability.

Suggested change
${{ inputs.release_script }} "${{ steps.bump-semver.outputs.new-version }}" "${{ steps.bump-semver.outputs.current-version }}"
# Validate that the release script path starts with ./.github/scripts/
if [[ "${{ inputs.release_script }}" != ./.github/scripts/* ]]; then
echo "::error::release_script must start with ./.github/scripts/"
exit 1
fi
# Run the script using bash for portability and to avoid permission issues
bash "${{ inputs.release_script }}" "${{ steps.bump-semver.outputs.new-version }}" "${{ steps.bump-semver.outputs.current-version }}"

Copilot uses AI. Check for mistakes.
Comment on lines +81 to +89
if [[ "$LATEST_TAG" =~ ^v?([0-9]+)\.([0-9]+)\.([0-9]+)(-.+)?$ ]]; then
MAJOR="${BASH_REMATCH[1]}"
MINOR="${BASH_REMATCH[2]}"
PATCH="${BASH_REMATCH[3]}"
else
MAJOR=0
MINOR=0
PATCH=0
fi
Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The regex pattern allows for optional pre-release suffixes with (-.+)? but this suffix is discarded when parsing the version components. If the current version has a pre-release suffix (e.g., v1.2.3-beta), the bumping logic will treat it as v1.2.3 and bump from there. This may be intentional, but it should be documented or handled explicitly to avoid confusion. Consider whether pre-release versions should trigger a warning or special handling.

Copilot uses AI. Check for mistakes.
secrets:
BOT_GITHUB_TOKEN: ${{ secrets.BOT_GITHUB_TOKEN }}
```

Copy link

Copilot AI Dec 5, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The documentation example is missing the release_script input parameter that is used in the actual implementation (.github/workflows/release.yml line 27). While this parameter is optional, the example should either include it to show users how to use it, or add a note explaining that an optional release_script parameter is available for custom release logic.

Suggested change
**Note**: The reusable release workflow also supports an optional `release_script` input parameter for custom release logic. You can provide a shell script path to override the default release steps. See the workflow documentation for details.

Copilot uses AI. Check for mistakes.
@gionn gionn marked this pull request as draft December 5, 2025 17:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants