Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change release job logic to handle more files #4631

Merged
merged 5 commits into from
Mar 13, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
dtzar marked this conversation as resolved.
Show resolved Hide resolved
echo "1 release notes file should be changed to create a release tag, found ${{ steps.changed-markdown-files.outputs.all_changed_files_count }}"
Copy link
Contributor

Choose a reason for hiding this comment

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

After we get this PR merged, it looks like the changed-files action has a built-in way to feed the list of files into a matrix that can spawn one job per file which might be able to make cutting multiple patches pretty slick.

https://github.com/tj-actions/changed-files/blob/257d47dfba22be3e0a17f6bad47ff07f7e76747c/.github/workflows/matrix-example.yml

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 }}