Skip to content

v0.40.0

v0.40.0 #10

Workflow file for this run

name: Test and Publish
on:
push:
branches:
- testing
tags:
- 'v*-test'
- 'v[0-9]+.[0-9]+.[0-9]+'
workflow_dispatch:
permissions:
contents: read
id-token: write
jobs:
test:
name: Test
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.11', '3.12', '3.13']
steps:
- uses: actions/checkout@v4
- name: Install uv and set Python version.
uses: astral-sh/setup-uv@v6
with:
version: "latest"
python-version: ${{ matrix.python-version }}
- name: Install libusb on Linux.
if: runner.os == 'Linux'
run: |
sudo apt-get update
sudo apt-get install -y libusb-1.0-0-dev libudev-dev
- name: Run tests - ${{ matrix.python-version }} - ${{ matrix.os }}
run: |
uv run --all-extras pytest
publish:
name: Build & Publish
needs: test
if: |
github.ref_type == 'tag' &&
startsWith(github.ref, 'refs/tags/v') &&
!endsWith(github.ref, '-test') &&
success()
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/project/busylight-for-humans
steps:
- uses: actions/checkout@v4
- name: Install uv and set Python version.
uses: astral-sh/setup-uv@v6
with:
version: "latest"
python-version: 3.13
- name: Build package.
run: |
uv build
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
generate-changelog:
name: Generate Changelog
needs: publish
if: |
github.ref_type == 'tag' &&
startsWith(github.ref, 'refs/tags/v') &&
!endsWith(github.ref, '-test') &&
success()
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Auto-generate Changelog
uses: BobAnkh/[email protected]
with:
REPO_NAME: 'JnyJny/busylight'
ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PATH: 'CHANGELOG.md'
COMMIT_MESSAGE: 'docs(CHANGELOG): update release notes'
TYPE: 'feat:Feature,bug:Bug Fixes,fix:Bug Fixes,docs:Documentation,refactor:Refactor,perf:Performance Improvements'
github-release:
name: Create GitHub Release
needs: publish
if: |
github.ref_type == 'tag' &&
startsWith(github.ref, 'refs/tags/v') &&
!endsWith(github.ref, '-test') &&
success()
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v6
with:
python-version: 3.8
- name: Build package
run: |
uv build
- name: Generate release notes
id: release_notes
run: |
# Get the tag name
TAG_NAME=${GITHUB_REF#refs/tags/}
# Get the previous tag
PREVIOUS_TAG=$(git describe --tags --abbrev=0 ${TAG_NAME}^ 2>/dev/null || echo "")
# Generate changelog
if [[ -n "$PREVIOUS_TAG" ]]; then
echo "## Changes since $PREVIOUS_TAG" >> release_notes.md
echo "" >> release_notes.md
git log --pretty=format:"- %s (%h)" ${PREVIOUS_TAG}..${TAG_NAME} >> release_notes.md
else
echo "## Initial Release" >> release_notes.md
echo "" >> release_notes.md
echo "- Initial release of busylight" >> release_notes.md
fi
# Check if there's a CHANGELOG.md file
if [[ -f "CHANGELOG.md" ]]; then
echo "" >> release_notes.md
echo "## Full Changelog" >> release_notes.md
echo "" >> release_notes.md
echo "See [CHANGELOG.md](CHANGELOG.md) for complete release notes." >> release_notes.md
fi
- name: Create GitHub Release
uses: ncipollo/release-action@v1
with:
artifacts: "dist/*"
bodyFile: "release_notes.md"
draft: false
prerelease: false
generateReleaseNotes: true
token: ${{ secrets.GITHUB_TOKEN }}