From 1ddd8e195cc50acb90cafc16cb80567c0def5976 Mon Sep 17 00:00:00 2001 From: DMITRIY PEDCHENKO Date: Wed, 27 Mar 2024 15:57:39 +0300 Subject: [PATCH] [DOP-13293] Add doc --- .github/workflows/release.yaml | 58 ++++++++++++++++++++++++++++++++++ 1 file changed, 58 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 425f6566..026b2e82 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -52,3 +52,61 @@ jobs: - name: Publish package uses: pypa/gh-action-pypi-publish@release/v1 + + - name: Get changelog + run: | + cat docs/changelog/$GITHUB_REF_NAME.rst > changelog.rst + + - name: Prepare rST syntax for conversion to Markdown + run: | + # Replace Github links from Sphinx syntax with Markdown + sed -i -E 's/:github:issue:`(.*)`/#\1/g' changelog.rst + sed -i -E 's/:github:pull:`(.*)`/#\1/g' changelog.rst + sed -i -E 's/:github:user:`(.*)`/@\1/g' changelog.rst + sed -i -E 's/:github:org:`(.*)`/@\1/g' changelog.rst + + - name: Convert rST to Markdown + uses: docker://pandoc/core:2.9 + with: + args: >- + --output=changelog.md + --from=rst + --to=gfm + --wrap=none + changelog.rst + + - name: Fixing Markdown syntax after conversion + run: | + # Replace ``` {.python caption="abc"} with ```python caption="abc" + sed -i -E 's/``` \{\.(.*)\}/```\1/g' changelog.md + + # Replace ``` python with ```python + sed -i -E 's/``` (\w+)/```\1/g' changelog.md + + # Replace \# with # + sed -i -E 's/\\#/#/g' changelog.md + + - name: Get release name + id: release-name + run: | + # Release name looks like: 0.7.0 (2023-05-15) + echo -n name= > "$GITHUB_OUTPUT" + cat changelog.md | head -1 | sed -E "s/#+\s*//g" >> "$GITHUB_OUTPUT" + + - name: Fix headers + run: | + # Remove header with release name + sed -i -e '1,2d' changelog.md + + - name: Create Github release + id: create_release + uses: softprops/action-gh-release@v2 + with: + token: ${{ secrets.GITHUB_TOKEN }} + draft: false + prerelease: false + name: ${{ steps.release-name.outputs.name }} + body_path: changelog.md + files: | + dist/* + openapi.json