chore(build): improve changelog generation in markdown format #15
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI/CD | |
on: | |
push: | |
paths-ignore: | |
- '.gitignore' | |
- 'CHANGELOG.md' | |
- 'LICENSE' | |
- 'README.md' | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
test: | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macos-latest | |
python-version: | |
- '3.10' | |
- '3.11' | |
- '3.12' | |
runs-on: ${{ matrix.os }} | |
name: Test on Python ${{ matrix.python-version }}, on ${{ matrix.os }} | |
timeout-minutes: 45 | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install poetry | |
run: pip install poetry | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Restore Python dependencies | |
run: poetry install | |
- name: Test | |
shell: bash | |
run: poetry run python -m unittest discover -v -s tests | |
release: | |
needs: test | |
if: github.ref == 'refs/heads/master' | |
runs-on: ubuntu-latest | |
name: Release on PyPI and GitHub | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Install poetry | |
run: pip install poetry | |
- name: Restore Python dependencies | |
run: poetry install | |
- name: Bump version | |
shell: bash | |
run: poetry run python bump_version.py --apply | tee CHANGELOG.md | |
- name: Build Python Package | |
run: poetry build | |
- name: Publish on TestPyPI | |
run: poetry publish --repository pypi-test --username __token__ --password ${{ secrets.TEST_PYPI_TOKEN }} | |
- name: Create GitHub Release | |
shell: bash | |
run: | | |
RELEASE_TAG=$(poetry version --short) | |
gh release create $RELEASE_TAG dist/* -t v$RELEASE_TAG -F CHANGELOG.md | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |