Skip to content

Commit

Permalink
use jq instead of python parsing for changelog JSON file
Browse files Browse the repository at this point in the history
  • Loading branch information
brainelectronics committed Oct 12, 2024
1 parent 354793d commit 4d7e7e9
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 8 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,12 +40,16 @@ jobs:
- name: Parse changelog
id: parse_changelog
run: |
poetry run changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt
poetry run changelog2version \
--changelog_file changelog.md \
--output changelog.json \
--print \
--debug
echo "CHANGELOG_JSON=$(jq -c . < changelog.json)" >> $GITHUB_ENV
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
cat latest_description.txt >> $GITHUB_OUTPUT
jq ".info.description" changelog.json >> $GITHUB_OUTPUT
echo '"EOT"' >> $GITHUB_OUTPUT
latest_version=$(poetry run changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
echo "latest_version=$latest_version" >> $GITHUB_ENV
echo "latest_version=$(jq '.info.version' changelog.json)" >> $GITHUB_ENV
- name: Build package
run: |
poetry run changelog2version \
Expand Down
12 changes: 8 additions & 4 deletions .github/workflows/test-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -37,12 +37,16 @@ jobs:
- name: Parse changelog
id: parse_changelog
run: |
poetry run changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['description'])" > latest_description.txt
poetry run changelog2version \
--changelog_file changelog.md \
--output changelog.json \
--print \
--debug
echo "CHANGELOG_JSON=$(jq -c . < changelog.json)" >> $GITHUB_ENV
echo 'LATEST_DESCRIPTION<<"EOT"' >> $GITHUB_OUTPUT
cat latest_description.txt >> $GITHUB_OUTPUT
jq ".info.description" changelog.json >> $GITHUB_OUTPUT
echo '"EOT"' >> $GITHUB_OUTPUT
latest_version=$(poetry run changelog2version --changelog_file changelog.md --print | python -c "import sys, json; print(json.load(sys.stdin)['info']['version'])")
echo "latest_version=$latest_version" >> $GITHUB_ENV
echo "latest_version=$(jq '.info.version' changelog.json)" >> $GITHUB_ENV
- name: Build package
run: |
poetry run changelog2version \
Expand Down
9 changes: 9 additions & 0 deletions .snippets/23.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Document and use no-internal option
<!--
type: feature
scope: internal
affected: all
-->

- Document `--no-internal` option in `README`
- Use `jq` instead of complex Python based `changelog.json` parsing in `release` and `test-release` workflows

0 comments on commit 4d7e7e9

Please sign in to comment.