chore: release v0.6.4 #24
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*' | |
| permissions: | |
| contents: write | |
| jobs: | |
| # ── Build leech-core (Rust extension) platform wheels ────────────── | |
| build-rust-wheels: | |
| name: Build leech-core (${{ matrix.target }}) | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| target: x86_64-unknown-linux-gnu | |
| - os: ubuntu-latest | |
| target: aarch64-unknown-linux-gnu | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - uses: actions/setup-python@v7 | |
| with: | |
| python-version: '3.12' | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| target: ${{ matrix.target }} | |
| args: --release --out dist --find-interpreter | |
| manylinux: auto | |
| working-directory: rust | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-rust-${{ matrix.target }} | |
| path: rust/dist/*.whl | |
| # ── Build leech-core sdist ───────────────────────────────────────── | |
| build-rust-sdist: | |
| name: Build leech-core sdist | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| persist-credentials: false | |
| - name: Build sdist | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: sdist | |
| args: --out dist | |
| working-directory: rust | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-rust-sdist | |
| path: rust/dist/*.tar.gz | |
| # ── Build leech (pure Python) sdist + wheel ──────────────────────── | |
| build-python: | |
| name: Build leech Python package | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v7 | |
| - uses: astral-sh/setup-uv@v10.0.1 | |
| - name: Build sdist and wheel | |
| run: uv build --out-dir dist | |
| - uses: actions/upload-artifact@v7 | |
| with: | |
| name: wheels-python | |
| path: dist/* | |
| # ── Create GitHub Release with all artifacts ─────────────────────── | |
| release: | |
| name: Create GitHub Release | |
| runs-on: ubuntu-latest | |
| needs: [build-rust-wheels, build-rust-sdist, build-python] | |
| steps: | |
| - uses: actions/checkout@v7 | |
| with: | |
| fetch-depth: 0 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v8 | |
| with: | |
| pattern: wheels-* | |
| path: dist | |
| merge-multiple: true | |
| - name: List release artifacts | |
| run: ls -lh dist/ | |
| - name: Extract version from tag | |
| id: get_version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/v} | |
| echo "version=${VERSION}" >> $GITHUB_OUTPUT | |
| echo "tag=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| - name: Check if pre-release | |
| id: check_prerelease | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| if [[ "$VERSION" == *"-alpha"* ]] || [[ "$VERSION" == *"-beta"* ]] || [[ "$VERSION" == *"-rc"* ]]; then | |
| echo "prerelease=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "prerelease=false" >> $GITHUB_OUTPUT | |
| fi | |
| - name: Extract changelog for this version | |
| id: changelog | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| CHANGELOG_CONTENT=$(awk -v ver="$VERSION" ' | |
| /^## \[/ { | |
| if (found) exit | |
| if ($0 ~ "\\[" ver "\\]") found=1 | |
| next | |
| } | |
| found { print } | |
| ' CHANGELOG.md) | |
| if [ -z "$CHANGELOG_CONTENT" ]; then | |
| CHANGELOG_CONTENT=$(awk -v ver="$VERSION" ' | |
| /^## / { | |
| if (found) exit | |
| if ($0 ~ ver) found=1 | |
| next | |
| } | |
| found { print } | |
| ' CHANGELOG.md) | |
| fi | |
| if [ -n "$CHANGELOG_CONTENT" ]; then | |
| echo "$CHANGELOG_CONTENT" > changelog_extract.md | |
| echo "found=true" >> $GITHUB_OUTPUT | |
| else | |
| echo "found=false" >> $GITHUB_OUTPUT | |
| touch changelog_extract.md | |
| fi | |
| - name: Create GitHub Release | |
| uses: softprops/action-gh-release@v3 | |
| with: | |
| name: Release ${{ steps.get_version.outputs.tag }} | |
| body_path: ${{ steps.changelog.outputs.found == 'true' && 'changelog_extract.md' || '' }} | |
| prerelease: ${{ steps.check_prerelease.outputs.prerelease }} | |
| draft: false | |
| generate_release_notes: true | |
| files: dist/* | |
| - name: Summary | |
| run: | | |
| echo "## Release Created! 🚀" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Version:** ${{ steps.get_version.outputs.version }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Tag:** ${{ steps.get_version.outputs.tag }}" >> $GITHUB_STEP_SUMMARY | |
| echo "- **Pre-release:** ${{ steps.check_prerelease.outputs.prerelease }}" >> $GITHUB_STEP_SUMMARY | |
| echo "" >> $GITHUB_STEP_SUMMARY | |
| echo "### Artifacts" >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY | |
| ls -1 dist/ >> $GITHUB_STEP_SUMMARY | |
| echo '```' >> $GITHUB_STEP_SUMMARY |