Skip to content

feat: add display_tempo property to Meter class (#56) #27

feat: add display_tempo property to Meter class (#56)

feat: add display_tempo property to Meter class (#56) #27

Workflow file for this run

name: Automated Release
on:
push:
branches: [ main ]
jobs:
release:
runs-on: ubuntu-latest
concurrency: release
permissions:
id-token: write # OIDC for PyPI trusted publishing
contents: write # Create releases and tags
actions: write # Update workflow permissions if needed
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Needed for semantic-release to work properly
token: ${{ secrets.GITHUB_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.10'
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-${{ hashFiles('**/pyproject.toml', '**/Pipfile.lock') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e .[dev]
pip install build twine toml
- name: Validate version consistency
run: |
echo "Checking version consistency across files..."
INIT_VERSION=$(python -c "import idtap; print(idtap.__version__)")
TOML_VERSION=$(python -c "import toml; print(toml.load('pyproject.toml')['project']['version'])")
echo "__init__.py version: $INIT_VERSION"
echo "pyproject.toml version: $TOML_VERSION"
if [ "$INIT_VERSION" != "$TOML_VERSION" ]; then
echo "❌ Version mismatch detected!"
echo "__init__.py: $INIT_VERSION"
echo "pyproject.toml: $TOML_VERSION"
exit 1
fi
echo "✅ Versions are consistent"
- name: Check if version bump is needed
id: release-check
run: |
# Check if commit message contains [skip release] or [skip ci]
COMMIT_MESSAGE=$(git log -1 --pretty=%B)
echo "Latest commit message: $COMMIT_MESSAGE"
if echo "$COMMIT_MESSAGE" | grep -q "\[skip release\]\|\[skip ci\]"; then
echo "should_release=false" >> $GITHUB_OUTPUT
echo "🚫 Skipping release due to [skip release] or [skip ci] in commit message"
else
echo "should_release=true" >> $GITHUB_OUTPUT
echo "✅ Version will be bumped"
fi
- name: Run tests
if: steps.release-check.outputs.should_release == 'true'
run: |
echo "Running tests before release..."
pytest idtap/tests/ -m "not integration"
- name: Configure git
if: steps.release-check.outputs.should_release == 'true'
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Bump version
if: steps.release-check.outputs.should_release == 'true'
id: bump-version
run: |
echo "Bumping patch version..."
NEW_VERSION=$(python scripts/bump_version.py | grep "New version:" | cut -d' ' -f3)
echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT
echo "Version bumped to: $NEW_VERSION"
- name: Build package
if: steps.release-check.outputs.should_release == 'true'
run: |
echo "Building package..."
python -m build
- name: Publish to PyPI
if: steps.release-check.outputs.should_release == 'true'
uses: pypa/gh-action-pypi-publish@release/v1
with:
# Using trusted publishing - no username/password needed
# PyPI trusted publisher must be configured for this repo
print-hash: true
- name: Commit version bump
if: steps.release-check.outputs.should_release == 'true'
run: |
git add idtap/__init__.py pyproject.toml docs/conf.py
git commit -m "chore: bump version to ${{ steps.bump-version.outputs.new_version }}"
git tag "v${{ steps.bump-version.outputs.new_version }}"
git push origin main
git push origin "v${{ steps.bump-version.outputs.new_version }}"
- name: Output release info
if: steps.release-check.outputs.should_release == 'true'
run: |
echo "🚀 Released version: ${{ steps.bump-version.outputs.new_version }}"
echo "📦 Package published to PyPI: https://pypi.org/project/idtap/${{ steps.bump-version.outputs.new_version }}/"