Skip to content

Commit 4d45122

Browse files
committed
ci(build): Adjust the release process based on the existence of the release notes file
- Add a step to check whether the release notes file for the corresponding branch exists - When the release notes file exists, use the content of the file for release - When the release notes file does not exist, skip the description content and only release the software package - Avoid triggering unnecessary recursive workflow runs when there is no description - Optimize the condition judgment of the release steps to improve the flexibility and reliability of the process
1 parent d911f26 commit 4d45122

1 file changed

Lines changed: 24 additions & 1 deletion

File tree

.github/workflows/build_packages.yaml

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,17 @@ jobs:
336336
pattern: packages-*
337337
merge-multiple: true
338338
path: _packages
339+
# 第一步:检查文件是否存在,将结果存入步骤输出
340+
- name: Check if release note file exists
341+
id: check_release_note
342+
run: |
343+
if [ -f "release_notes/${{ github.ref_name }}.md" ]; then
344+
echo "file_exists=true" >> $GITHUB_OUTPUT
345+
else
346+
echo "file_exists=false" >> $GITHUB_OUTPUT
347+
fi
339348
- uses: softprops/action-gh-release@v1
340-
if: github.ref_type == 'tag'
349+
if: steps.check_release_note.outputs.file_exists == 'true'
341350
with:
342351
## When you use the repository's GITHUB_TOKEN to perform tasks,
343352
## events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch,
@@ -349,6 +358,20 @@ jobs:
349358
#generate_release_notes: true
350359
name: NeuronEX ${{ github.ref_name }} Released
351360
body_path: release_notes/${{ github.ref_name }}.md
361+
files: |
362+
_packages/neuronex-*
363+
- uses: softprops/action-gh-release@v1
364+
if: steps.check_release_note.outputs.file_exists == 'false'
365+
with:
366+
## When you use the repository's GITHUB_TOKEN to perform tasks,
367+
## events triggered by the GITHUB_TOKEN, with the exception of workflow_dispatch and repository_dispatch,
368+
## will not create a new workflow run.
369+
## This prevents you from accidentally creating recursive workflow runs.
370+
## More info: https://docs.github.com/en/actions/using-workflows/triggering-a-workflow#triggering-a-workflow-from-a-workflow
371+
token: ${{ steps.app-token.outputs.token }}
372+
# prerelease: true
373+
#generate_release_notes: true
374+
name: NeuronEX ${{ github.ref_name }} Released
352375
body: "NeuronEX ${{ github.ref_name }} Released"
353376
files: |
354377
_packages/neuronex-*

0 commit comments

Comments
 (0)