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

View File

@ -28,9 +28,12 @@ outputs:
version: version:
description: "The current version number. For example, `1.3.0`" description: "The current version number. For example, `1.3.0`"
value: ${{ steps.yaclog-show.outputs.version }} value: ${{ steps.yaclog-show.outputs.version }}
body_file: body-file:
description: "Path to a temporary file containing the version body" 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: changelog:
description: "Path to the entire changelog file." description: "Path to the entire changelog file."
value: ${{ steps.yaclog-show.outputs.changelog }} 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` 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` 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') if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
run: | run: |
gh release create {{ '${{ github.ref_name }}' }} \ 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 }}' }}" --title "{{ '${{ steps.yaclog.outputs.name }}' }}"
env: env:
GH_TOKEN: {{ '${{ github.token }}' }} 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) body_fd, body_file = tempfile.mkstemp(text=True)
with os.fdopen(body_fd, 'w') as f: with os.fdopen(body_fd, 'w') as f:
f.write(sep.join([functions['body'](v, kwargs) for v in versions])) 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}') click.echo(f'changelog={obj.path}')
return return