Add body-file output, alias body_file to it

This commit is contained in:
Andrew Cassidy 2024-08-27 22:27:24 -07:00
parent e31a8d094e
commit aad894fa08
4 changed files with 12 additions and 9 deletions

View File

@ -45,8 +45,8 @@ jobs:
needs: test
runs-on: ubuntu-22.04
outputs:
body_file: ${{ steps.yaclog-show.outputs.body_file }}
version_name: ${{ steps.yaclog-show.outputs.name }}
body-file: ${{ steps.yaclog-show.outputs.body-file }}
version-name: ${{ steps.yaclog-show.outputs.name }}
steps:
- uses: actions/checkout@v4
@ -109,8 +109,8 @@ jobs:
- name: Publish to Github
run: >
gh release create ${{ github.ref_name }}
--notes-file "${{ needs.build.outputs.body_file }}"
--title "${{ needs.build.outputs.version_name }}"
--notes-file "${{ needs.build.outputs.body-file }}"
--title "${{ needs.build.outputs.version-name }}"
dist/*
env:
GH_TOKEN: ${{ github.token }}

View File

@ -28,9 +28,12 @@ outputs:
version:
description: "The current version number. For example, `1.3.0`"
value: ${{ steps.yaclog-show.outputs.version }}
body_file:
body-file:
description: "Path to a temporary file containing the version body"
value: ${{ steps.yaclog-show.outputs.body_file }}
value: ${{ steps.yaclog-show.outputs.body-file }}
body_file:
description: "Alias for body-file"
value: ${{ steps.yaclog-show.outputs.body-file }}
changelog:
description: "Path to the entire changelog file."
value: ${{ steps.yaclog-show.outputs.changelog }}

View File

@ -46,7 +46,7 @@ The most recent version name, equivalent to the output of `yaclog show --name`.
The entire header for the most recent version, equivalent to the output of `yaclog show --header`. For example, `Version 1.3.0 - 2024-08-08`
```
```{confval} body_file
```{confval} body-file
The path to a temporary file containing the body of the most recent version. Contents equivalent to `yaclog show --body`
```
@ -82,7 +82,7 @@ jobs:
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: |
gh release create {{ '${{ github.ref_name }}' }} \
--notes-file "{{ '${{ steps.yaclog.outputs.body_file }}' }}" \
--notes-file "{{ '${{ steps.yaclog.outputs.body-file }}' }}" \
--title "{{ '${{ steps.yaclog.outputs.name }}' }}"
env:
GH_TOKEN: {{ '${{ github.token }}' }}

View File

@ -123,7 +123,7 @@ def show(obj: Changelog, all_versions, markdown, mode, version_names, gh_actions
body_fd, body_file = tempfile.mkstemp(text=True)
with os.fdopen(body_fd, 'w') as f:
f.write(sep.join([functions['body'](v, kwargs) for v in versions]))
click.echo(f'body_file={body_file}')
click.echo(f'body-file={body_file}')
click.echo(f'changelog={obj.path}')
return