Skip to content

Bump version to 1.1.1 #9

Bump version to 1.1.1

Bump version to 1.1.1 #9

Workflow file for this run

name: Release and Publish
on:
push:
tags:
- 'v*.*.*'
branches: [ main, develop ]
pull_request:
branches: [ main, develop ]
env:
PYTHON_DEFAULT_VERSION: "3.11"
jobs:
test:
name: Test Python ${{ matrix.python-version }} on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
os: [ubuntu-latest, windows-latest, macos-latest]
exclude:
# Reduce matrix size for faster CI
- os: windows-latest
python-version: "3.8"
- os: windows-latest
python-version: "3.9"
- os: macos-latest
python-version: "3.8"
- os: macos-latest
python-version: "3.9"
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -e ".[dev,test]"
- name: Lint with flake8
run: |
# Stop the build if there are Python syntax errors or undefined names
flake8 dotloop --count --select=E9,F63,F7,F82 --show-source --statistics
# Exit-zero treats all errors as warnings
flake8 dotloop --count --exit-zero --max-complexity=10 --max-line-length=88 --statistics
- name: Check code formatting with black
run: |
black --check --diff dotloop tests
- name: Check import sorting with isort
run: |
isort --check-only --diff dotloop tests
- name: Type check with mypy
run: |
mypy dotloop
- name: Test with pytest
run: |
pytest --cov=dotloop --cov-report=xml --cov-report=term-missing --cov-fail-under=100
- name: Upload coverage to Codecov
if: matrix.python-version == env.PYTHON_DEFAULT_VERSION && matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
file: ./coverage.xml
flags: unittests
name: codecov-umbrella
fail_ci_if_error: false
security:
name: Security checks
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: 'pip'
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install bandit[toml] safety
- name: Run bandit security linter
run: |
bandit -r dotloop -f json -o bandit-report.json || true
bandit -r dotloop
- name: Run safety check
run: |
safety check --json --output safety-report.json || true
safety check
build:
name: Build package
runs-on: ubuntu-latest
needs: [test, security]
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_DEFAULT_VERSION }}
cache: 'pip'
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install build twine
- name: Build package
run: |
python -m build
- name: Check package
run: |
twine check dist/*
- name: Upload build artifacts
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
publish:
name: Publish to PyPI
runs-on: ubuntu-latest
needs: [test, security, build]
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
permissions:
id-token: write # For trusted publishing
contents: write # For creating releases
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Full history for changelog
- name: Download build artifacts
uses: actions/download-artifact@v3
with:
name: dist
path: dist/
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
- name: Publish to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
password: ${{ secrets.PYPI_API_TOKEN }}
verbose: true
- name: Generate changelog
id: changelog
run: |
# Extract changelog for this version
if [ -f CHANGELOG.md ]; then
# Try to extract changelog section for this version
awk '/^## \['"${{ steps.version.outputs.version }}"'\]/{flag=1; next} /^## \[/{flag=0} flag' CHANGELOG.md > release_notes.md
if [ ! -s release_notes.md ]; then
echo "Release ${{ steps.version.outputs.version }}" > release_notes.md
echo "" >> release_notes.md
echo "See [CHANGELOG.md](CHANGELOG.md) for details." >> release_notes.md
fi
else
echo "Release ${{ steps.version.outputs.version }}" > release_notes.md
echo "" >> release_notes.md
echo "Automated release from tag ${{ github.ref_name }}" >> release_notes.md
fi
- name: Create GitHub Release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref_name }}
release_name: Release ${{ steps.version.outputs.version }}
body_path: release_notes.md
draft: false
prerelease: false
- name: Upload release assets
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: dist/
asset_name: dotloop-${{ steps.version.outputs.version }}-dist
asset_content_type: application/zip
notify:
name: Notify on success
runs-on: ubuntu-latest
needs: [publish]
if: success()
steps:
- name: Extract version from tag
id: version
run: |
VERSION=${GITHUB_REF#refs/tags/v}
echo "version=$VERSION" >> $GITHUB_OUTPUT
- name: Notify success
run: |
echo "🎉 Successfully published dotloop v${{ steps.version.outputs.version }} to PyPI!"
echo "📦 Package: https://pypi.org/project/dotloop/${{ steps.version.outputs.version }}/"
echo "🏷️ Release: https://github.com/${{ github.repository }}/releases/tag/${{ github.ref_name }}"