Release v0.2.5 #50
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*'] | |
| jobs: | |
| # Configuration - Edit this section to enable/disable tests | |
| config: | |
| name: Configuration | |
| runs-on: ubuntu-latest | |
| outputs: | |
| run-tests: ${{ steps.config.outputs.run-tests }} | |
| os-matrix: ${{ steps.config.outputs.os-matrix }} | |
| python-matrix: ${{ steps.config.outputs.python-matrix }} | |
| steps: | |
| - id: config | |
| run: | | |
| # Set to 'true' to run tests before building wheels, 'false' to skip tests | |
| echo "run-tests=false" >> $GITHUB_OUTPUT | |
| # Test matrix configuration (only used if run-tests is 'true') | |
| echo 'os-matrix=["ubuntu-latest", "macos-latest", "windows-latest"]' >> $GITHUB_OUTPUT | |
| echo 'python-matrix=["3.8", "3.9", "3.10", "3.11", "3.12", "3.13", "3.14"]' >> $GITHUB_OUTPUT | |
| test: | |
| name: Run Tests | |
| needs: config | |
| if: needs.config.outputs.run-tests == 'true' | |
| uses: ./.github/workflows/_test.yml | |
| with: | |
| os-matrix: ${{ needs.config.outputs.os-matrix }} | |
| python-matrix: ${{ needs.config.outputs.python-matrix }} | |
| primary-os: "ubuntu-latest" | |
| primary-python: "3.11" | |
| secrets: inherit | |
| # Build wheels for each platform in parallel | |
| build-windows: | |
| name: Build Windows Wheels | |
| needs: [config, test] | |
| if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped') | |
| uses: ./.github/workflows/_build_windows.yml | |
| build-linux: | |
| name: Build Linux Wheels | |
| needs: [config, test] | |
| if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped') | |
| uses: ./.github/workflows/_build_linux.yml | |
| build-macos: | |
| name: Build macOS Wheels | |
| needs: [config, test] | |
| if: always() && (needs.test.result == 'success' || needs.test.result == 'skipped') | |
| uses: ./.github/workflows/_build_macos.yml | |
| publish: | |
| name: Publish Release | |
| needs: [build-windows, build-linux, build-macos] | |
| if: always() && startsWith(github.ref, 'refs/tags/v') | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: PYPI_RELEASE | |
| url: https://pypi.org/project/httpmorph/ | |
| permissions: | |
| contents: write | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Download wheels | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: dist/ | |
| pattern: wheels-* | |
| merge-multiple: false | |
| continue-on-error: true | |
| - name: Flatten wheels and report build status | |
| run: | | |
| mkdir -p wheels | |
| # Check which platforms built successfully | |
| echo "====================" | |
| echo "Build Status Report" | |
| echo "====================" | |
| for platform in windows linux macos; do | |
| if [ -d "dist/wheels-$platform" ]; then | |
| wheel_count=$(find "dist/wheels-$platform" -name "*.whl" 2>/dev/null | wc -l) | |
| if [ "$wheel_count" -gt 0 ]; then | |
| echo "✅ $platform: $wheel_count wheels built" | |
| else | |
| echo "❌ $platform: No wheels found" | |
| fi | |
| else | |
| echo "❌ $platform: Build failed or artifacts missing" | |
| fi | |
| done | |
| echo "====================" | |
| # Flatten all available wheels | |
| find dist/ -name "*.whl" -exec cp {} wheels/ \; 2>/dev/null || true | |
| # List wheels | |
| if [ -n "$(ls -A wheels/)" ]; then | |
| echo "" | |
| echo "Available wheels:" | |
| ls -lh wheels/ | |
| echo "" | |
| echo "Total: $(ls wheels/*.whl 2>/dev/null | wc -l) wheels" | |
| else | |
| echo "" | |
| echo "⚠️ No wheels available for release" | |
| exit 1 | |
| fi | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v1 | |
| with: | |
| files: wheels/*.whl | |
| generate_release_notes: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Publish to PyPI | |
| env: | |
| TWINE_USERNAME: __token__ | |
| TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} | |
| run: | | |
| pip install twine | |
| if [ -n "$TWINE_PASSWORD" ]; then | |
| echo "Publishing to PyPI..." | |
| twine upload wheels/*.whl --skip-existing --verbose | |
| else | |
| echo "⚠️ PYPI_API_TOKEN not set - skipping PyPI upload" | |
| echo "To publish to PyPI, add PYPI_API_TOKEN to the PYPI_RELEASE environment secrets" | |
| fi | |
| shell: bash |