ci: clean-up #7
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: release | |
on: | |
push: | |
branches: | |
- master | |
env: | |
PYTHON_VERSION: 3.10.10 | |
POETRY_VERSION: 1.6.1 | |
jobs: | |
publish_and_release: | |
name: Publish Python 🐍 distribution 📦 to PyPI and create GitHub Release | |
runs-on: [self-hosted] | |
container: | |
image: python:3.10 | |
environment: | |
name: pypi | |
url: https://pypi.org/p/muttlib | |
permissions: | |
id-token: write # Mandatory for trusted publishing | |
contents: write # Necessary for creating GitHub Release | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Get muttlib version | |
id: version | |
run: | | |
echo "::set-output name=version::$(grep current_version .bumpversion.cfg | cut -d= -f2 | xargs)" | |
- name: Extract release notes from changelog | |
id: release_notes | |
run: | | |
version=${{ steps.version.outputs.version }} | |
release_notes=$(sed -n "/^## \[$version\]/,/^## /p" ./CHANGELOG.md | sed '1d;$d') | |
echo "::set-output name=release_notes::$release_notes" | |
echo "$release_notes" > release_notes.txt | |
- name: Install Poetry | |
run: pip install poetry==${{ env.POETRY_VERSION }} | |
- name: Install dependencies | |
run: poetry install | |
- name: Build package | |
run: poetry build | |
- name: Publish package distributions to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
- name: GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
tag_name: v${{ steps.version.outputs.version }} | |
name: v${{ steps.version.outputs.version }} | |
body_path: release_notes.txt | |
draft: false | |
prerelease: false |