From 68f713c16144f9b7862804b118dfe3f0a7c1379e Mon Sep 17 00:00:00 2001 From: Kelly Sovacool Date: Fri, 12 Jan 2024 13:07:36 -0500 Subject: [PATCH] fix: import yaml & refactor --- .github/workflows/draft-release.yml | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/.github/workflows/draft-release.yml b/.github/workflows/draft-release.yml index c4c2eb6..10e1f47 100644 --- a/.github/workflows/draft-release.yml +++ b/.github/workflows/draft-release.yml @@ -74,7 +74,7 @@ jobs: if not (greater == 1 and equal == 2): raise ValueError(f"Next version must only increment one number at a time. Current version: {current_version}. Proposed next version: {next_version}") - - name: Get release notes & update changelog + - name: Get release notes, update changelog & version file shell: python {0} run: | import os @@ -96,24 +96,25 @@ jobs: next_release_lines.append(line) with open(".github/latest-release.md", "w") as outfile: - outfile.write(''.join(next_release_lines)) + outfile.writelines(next_release_lines) with open('CHANGELOG.md', 'w') as outfile: - outfile.write(''.join(changelog_lines)) + outfile.writelines(changelog_lines) + with open("VERSION", "w") as outfile: + outfile.write(f"{next_version}\n") - - name: Update citation & version files + - name: Update citation shell: python {0} run: | from cffconvert.cli.create_citation import create_citation from cffconvert.cli.validate_or_write_output import validate_or_write_output + import yaml + citation = create_citation('CITATION.cff', None) citation._implementation.cffobj['version'] = "${{ env.NEXT_VERSION }}" citation._implementation.cffobj['date-released'] = "${{ env.DATE }}" with open('CITATION.cff', 'w') as outfile: outfile.write(yaml.dump(citation._implementation.cffobj, sort_keys=False)) - with open("VERSION", "w") as outfile: - outfile.write("${{ env.NEXT_STRICT }}") - - name: Commit & push to branch run: | git config --local user.name "github-actions[bot]"