Skip to content

ci: add release changelog generation and push #6

ci: add release changelog generation and push

ci: add release changelog generation and push #6

Workflow file for this run

name: Latest Release
on:
release:
types: [published]
workflow_dispatch:
jobs:
publish-release:
runs-on: ubuntu-latest
permissions:
id-token: write
environment: release
steps:
- name: Check out repository
uses: actions/checkout@v4
- uses: actions/setup-python@v4
with:
python-version: "3.12"
- uses: pdm-project/setup-pdm@v3
name: Set up PDM
with:
python-version: "3.12"
cache: true
- name: Build package
run: pdm build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
- name: Generate changelog
runs-on: ubuntu-latest
outputs:
release_body: ${{ steps.git-cliff.outputs.content }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Generate a changelog
uses: orhun/git-cliff-action@main
id: git-cliff
with:
config: pyproject.toml
args: -vv --latest --strip header
- name: Commit changelog
run: |
git checkout main
git config user.name 'github-actions[bot]'
git config user.email 'github-actions[bot]@users.noreply.github.com'
set +e
git add docs/CHANGELOG.rst
git commit -m "release: update changelog"
git push https://${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY}.git main