Skip to content

Commit

Permalink
Filter proper changed files
Browse files Browse the repository at this point in the history
Signed-off-by: David Tesar <[email protected]>
  • Loading branch information
dtzar committed Mar 7, 2024
1 parent 2b9d528 commit eb9c1c6
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -31,20 +31,25 @@ jobs:
- name: Get changed files
id: changed-files
uses: tj-actions/changed-files@800a2825992141ddde1a8bca8ad394cec34d3188 # tag=v42.0.5
with:
files: |
CHANGELOG/.*\.md
- name: Get release version
id: release-version
run: |
if [[ ${{ steps.changed-files.outputs.all_changed_files_count }} != 1 ]]; then
echo "1 release notes file should be changed to create a release tag, found ${{ steps.changed-files.outputs.all_changed_files_count }}"
exit 1
fi
for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do
if [[ $changed_file =~ CHANGELOG/.*\.md ]]; then
export RELEASE_VERSION=$(echo "${changed_file}" | grep -oP '(?<=/)[^/]+(?=\.md)')
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
if [[ "$RELEASE_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
echo "Valid semver: $RELEASE_VERSION"
else
echo "Invalid semver: $RELEASE_VERSION"
exit 1
fi
export RELEASE_VERSION=$(echo "${changed_file}" | grep -oP '(?<=/)[^/]+(?=\.md)')
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
if [[ "$RELEASE_VERSION" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?$ ]]; then
echo "Valid semver: $RELEASE_VERSION"
else
echo "Invalid semver: $RELEASE_VERSION"
exit 1
fi
done
- name: Determine the release branch to use
Expand Down

0 comments on commit eb9c1c6

Please sign in to comment.