Skip to content

v0.9.2

v0.9.2 #8

Workflow file for this run

name: Publish
on:
release:
types: [published]
permissions:
contents: write
id-token: write # Required for trusted publishing
jobs:
release-build:
name: Build Release
runs-on: ubuntu-latest
outputs:
version: ${{ steps.version.outputs.version }}
changelog: ${{ steps.changelog.outputs.changelog }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0 # Fetch all history for changelog generation
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Install Poetry
uses: snok/install-poetry@v1
with:
version: 1.7.1
virtualenvs-create: true
virtualenvs-in-project: true
- name: Verify version matches tag
id: version
run: |
VERSION=$(poetry version -s)
TAG=${GITHUB_REF#refs/tags/v}
if [ "$VERSION" != "$TAG" ]; then
echo "Version mismatch: $VERSION != $TAG"
exit 1
fi
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Build package
run: poetry build
- name: Check dist contents
run: |
ls -l dist/
if [ ! -f "dist/commitloom-"*".tar.gz" ] || [ ! -f "dist/commitloom-"*".whl" ]; then
echo "Missing distribution files"
exit 1
fi
- name: Extract changelog entry
id: changelog
run: |
VERSION=$(poetry version -s)
CHANGELOG_ENTRY=$(awk -v ver="$VERSION" '
BEGIN { found=0; entry="" }
$0 ~ "^## \\[" ver "\\]" { found=1; next }
found && /^## / { exit }
found { entry = entry $0 "\n" }
END { print entry }
' CHANGELOG.md)
echo "changelog<<EOF" >> $GITHUB_OUTPUT
echo "$CHANGELOG_ENTRY" >> $GITHUB_OUTPUT
echo "EOF" >> $GITHUB_OUTPUT
- name: Upload distributions
uses: actions/upload-artifact@v4
with:
name: release-dists
path: dist/
pypi-publish:
name: Publish to PyPI
needs: [release-build]
runs-on: ubuntu-latest
steps:
- name: Retrieve release distributions
uses: actions/download-artifact@v4
with:
name: release-dists
path: dist/
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
packages-dir: dist/
- name: Update GitHub Release
uses: softprops/action-gh-release@v1
with:
files: |
dist/*.whl
dist/*.tar.gz
body: |
${{ needs.release-build.outputs.changelog }}
## Installation
```bash
pip install commitloom==${{ needs.release-build.outputs.version }}
```
## Documentation
For full documentation, visit: https://github.com/Arakiss/commitloom
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}