name: Release on: push: tags: - 'v*' # Trigger on version tags like v1.0.0, v0.13.0, etc. jobs: release: runs-on: ubuntu-latest permissions: id-token: write contents: write steps: - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Set up Python uses: actions/setup-python@v5 with: python-version: "3.12" - name: Install uv run: | pip install uv - name: Install dependencies and build run: | uv venv uv sync uv build - name: Verify version matches tag run: | # Get version from built package PACKAGE_VERSION=$(uv run python -c "import basic_memory; print(basic_memory.__version__)") TAG_VERSION=${GITHUB_REF_NAME#v} # Remove 'v' prefix from tag echo "Package version: $PACKAGE_VERSION" echo "Tag version: $TAG_VERSION" if [ "$PACKAGE_VERSION" != "$TAG_VERSION" ]; then echo "Version mismatch! Package: $PACKAGE_VERSION, Tag: $TAG_VERSION" exit 1 fi - name: Create GitHub Release uses: softprops/action-gh-release@v2 with: files: | dist/*.whl dist/*.tar.gz generate_release_notes: true tag_name: ${{ github.ref_name }} token: ${{ secrets.GITHUB_TOKEN }} - name: Publish to PyPI uses: pypa/gh-action-pypi-publish@release/v1 with: password: ${{ secrets.PYPI_TOKEN }}