Minor updates for PyPi build #1
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' # Matches v1.0.0, v2.1.3, etc. | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Release version (e.g., v3.1.0)' | |
| required: true | |
| permissions: | |
| contents: write | |
| id-token: write | |
| checks: read | |
| jobs: | |
| test-before-release: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Install dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| pip install pytest pytest-cov pytest-asyncio | |
| pip install -e . | |
| - name: Run complete test suite | |
| run: | | |
| pytest tests/ -v --tb=short --cov=src/analyzeMFT --cov-report=term-missing | |
| - name: Build and validate distribution | |
| run: | | |
| pip install build twine | |
| python -m build | |
| twine check dist/* | |
| create-release: | |
| needs: test-before-release | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/') | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| - name: Set up Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: '3.11' | |
| - name: Verify version matches tag | |
| run: | | |
| TAG_NAME="${GITHUB_REF_NAME}" | |
| TAG_VERSION="${TAG_NAME#v}" | |
| PACKAGE_VERSION=$(python -c "from src.analyzeMFT import __version__; print(__version__)") | |
| echo "Tag: $TAG_NAME (version: $TAG_VERSION)" | |
| echo "Package version: $PACKAGE_VERSION" | |
| if [ "$TAG_VERSION" != "$PACKAGE_VERSION" ]; then | |
| echo "[[ERROR]] Version mismatch between tag and package" | |
| exit 1 | |
| fi | |
| - name: Install build tools | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install build twine | |
| - name: Build distribution | |
| run: | | |
| python -m build | |
| ls -la dist/ | |
| - name: Create Release Notes | |
| run: | | |
| echo "# Release ${{ github.ref_name }}" > release_notes.md | |
| echo "" >> release_notes.md | |
| echo "## What's New" >> release_notes.md | |
| echo "" >> release_notes.md | |
| if [ -f CHANGES.md ] || [ -f CHANGELOG.md ]; then | |
| cat CHANGES.md >> release_notes.md | |
| else | |
| echo "See commit history for details." >> release_notes.md | |
| fi | |
| echo "" >> release_notes.md | |
| echo "## Testing" >> release_notes.md | |
| echo "- All tests passed on Python 3.8–3.12" >> release_notes.md | |
| echo "- Cross-platform tested (Linux, Windows, macOS)" >> release_notes.md | |
| echo "- Coverage >80%" >> release_notes.md | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ github.ref_name }} | |
| name: Release ${{ github.ref_name }} | |
| body_path: release_notes.md | |
| draft: false | |
| prerelease: false | |
| fail_on_unmatched_files: false | |
| files: dist/* | |
| # Optional: Publish to PyPI using OIDC | |
| # publish-pypi: | |
| # needs: create-release | |
| # runs-on: ubuntu-latest | |
| # permissions: | |
| # id-token: write | |
| # steps: | |
| # - name: Download dist | |
| # uses: actions/download-artifact@v3 | |
| # with: | |
| # name: dist | |
| # path: dist/ | |
| # | |
| # - name: Publish to PyPI | |
| # uses: pypa/[email protected] |