Skip to content

Commit

Permalink
Change release job logic to handle more files (kubernetes-sigs#4631)
Browse files Browse the repository at this point in the history
* Change logic for only one file

Signed-off-by: David Tesar <[email protected]>

* Filter proper changed files

Signed-off-by: David Tesar <[email protected]>

* Fix logic

Signed-off-by: David Tesar <[email protected]>

---------

Signed-off-by: David Tesar <[email protected]>
  • Loading branch information
dtzar authored and bravebeaver committed Mar 19, 2024
1 parent 58c2c28 commit 7037c97
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,16 +28,18 @@ jobs:
with:
fetch-depth: 0
- name: Get changed files
id: changed-files
id: changed-markdown-files
uses: tj-actions/changed-files@aa08304bd477b800d468db44fe10f6c61f7f7b11 # tag=v42.1.0
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 }}"
if [[ ${{ steps.changed-markdown-files.outputs.all_changed_files_count }} != 1 ]]; then
echo "1 release notes file should be changed to create a release tag, found ${{ steps.changed-markdown-files.outputs.all_changed_files_count }}"
exit 1
fi
for changed_file in ${{ steps.changed-files.outputs.all_changed_files }}; do
for changed_file in ${{ steps.changed-markdown-files.outputs.all_changed_files }}; do
export RELEASE_VERSION=$(echo "${changed_file}" | grep -oP '(?<=/)[^/]+(?=\.md)')
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_ENV
echo "RELEASE_VERSION=$RELEASE_VERSION" >> $GITHUB_OUTPUT
Expand Down Expand Up @@ -121,4 +123,4 @@ jobs:
draft: true
files: out/*
body_path: ${{ env.RELEASE_TAG }}.md
tag_name: ${{ env.RELEASE_TAG }}
tag_name: ${{ env.RELEASE_TAG }}

0 comments on commit 7037c97

Please sign in to comment.