Skip to content

Commit

Permalink
Let's try this!
Browse files Browse the repository at this point in the history
  • Loading branch information
Cadair committed Feb 19, 2024
1 parent 0d1f547 commit de48422
Show file tree
Hide file tree
Showing 2 changed files with 70 additions and 0 deletions.
21 changes: 21 additions & 0 deletions .github/changelog_filter.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
"""
A pandoc filter which returns only the content between the start of the file
and the second top level heading.
"""
import io
import sys
import json

input_stream = io.TextIOWrapper(sys.stdin.buffer, encoding='utf-8')
source = input_stream.read()
doc = json.loads(source)

output_blocks = []
for block in doc["blocks"]:
if output_blocks and block["t"] == "Header" and block["c"][0] == 1:
break
print(block["c"], file=sys.stderr)
output_blocks.append(block)

doc["blocks"] = output_blocks
sys.stdout.write(json.dumps(doc))
49 changes: 49 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,55 @@ jobs:
secrets:
pypi_token: ${{ secrets.PYPI_API_TOKEN }}

make_gh_release:
# needs: [publish]
# if: startsWith(github.event.ref, 'refs/tags/v') && !endsWith(github.event.ref, '.dev')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup Python 3.11
uses: actions/setup-python@v5
with:
python-version: "3.11"

- name: Convert to markdown with pandoc
uses: docker://pandoc/core:2.9
with:
args: >- # allows you to break string into multiple lines
--wrap=none
-t markdown_strict
--output=release-changelog.md
--filter .github/changelog_filter.py
CHANGELOG.rst
- name: Capture Markdown Changelog
id: markdown-changelog
run: |
{
echo 'content<<EOF'
cat release-changelog.md
echo EOF
} >> "$GITHUB_OUTPUT"
- name: debug
run: |
echo '${{ steps.markdown-changelog.outputs.content }}'
# - name: Create GitHub Release
# uses: actions/github-script@v7
# id: create-release
# with:
# script: |
# return await github.rest.repos.createRelease({
# owner: context.repo.owner,
# repo: context.repo.repo,
# tag_name: "v${{ inputs.version }}",
# name: "v${{ inputs.version }}",
# body: `${{ steps.markdown-changelog.outputs.content }}`
# });
notify:
if: always() && github.event_name != 'pull_request' && github.ref_name == 'main'
needs: [tests, allowed-fail-tests, publish]
Expand Down

0 comments on commit de48422

Please sign in to comment.