Wheel Release #31
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: "Wheel Release" | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| dry-run: | |
| description: 'Set to true to only print files without publishing' | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| Linux-Build-Wheel: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| pyver: ["10", "11", "12", "13", "14", "14t"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Set up Python 3.${{ matrix.pyver }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.${{ matrix.pyver }} | |
| - name: Build Wheel | |
| run: | | |
| python -m pip install build | |
| python -m build --wheel | |
| - name: Audit Wheel | |
| id: audit-wheel | |
| run: | | |
| python -m pip install auditwheel | |
| auditwheel repair dist/*.whl | |
| - name: Upload Wheel To Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linux-ssrjson-benchmark-wheel-python3${{ matrix.pyver }} | |
| path: wheelhouse/*.whl | |
| Windows-Build-Wheel: | |
| runs-on: windows-latest | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| pyver: ["10", "11", "12", "13", "14", "14t"] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Set up Python 3.${{ matrix.pyver }} | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: 3.${{ matrix.pyver }} | |
| - name: Build Wheel | |
| run: | | |
| python -m pip install build | |
| python -m build --wheel | |
| - name: Upload Wheel To Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: windows-ssrjson-benchmark-wheel-python3${{ matrix.pyver }} | |
| path: dist/*.whl | |
| Build-Tarball: | |
| runs-on: ubuntu-latest | |
| strategy: | |
| fail-fast: false | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Build Tarball | |
| id: build-tarball | |
| run: | | |
| python -m pip install build | |
| python -m build --sdist | |
| echo "ARTIFACT_NAME=$(readlink -f dist/*.tar.gz)" >> $GITHUB_OUTPUT | |
| - name: Print Tarball Hash | |
| run: | | |
| sha256sum ${{ steps.build-tarball.outputs.ARTIFACT_NAME }} | awk '{print $1}' > sha256sum.txt | |
| cat sha256sum.txt | |
| - name: Upload Tarball To Artifact | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: ssrjson-benchmark-tarball | |
| path: ${{ steps.build-tarball.outputs.ARTIFACT_NAME }} | |
| Publish: | |
| runs-on: ubuntu-latest | |
| needs: | |
| - Build-Tarball | |
| - Linux-Build-Wheel | |
| - Windows-Build-Wheel | |
| permissions: | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@main | |
| - name: Download Artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| merge-multiple: true | |
| path: ./artifacts/ | |
| pattern: "*ssrjson*" | |
| - name: Print all downloaded files | |
| run: | | |
| echo "All downloaded files:" | |
| find ./artifacts -type f | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.x' | |
| - name: Extract version from pyproject.toml | |
| id: extract-version | |
| run: | | |
| VERSION=$(grep -Po '(?<=^version = ")[^"]*' pyproject.toml) | |
| if [ -z "$VERSION" ]; then | |
| echo "Error: Version not found in pyproject.toml" | |
| exit 1 | |
| fi | |
| echo "VERSION=$VERSION" >> $GITHUB_ENV | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: ${{ github.event.inputs.dry-run == 'false' }} | |
| with: | |
| files: "./artifacts/*" | |
| tag_name: "v${{ env.VERSION }}" | |
| name: Release ${{ env.VERSION }} | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.ACTION_GITHUB_TOKEN }} | |
| - name: Publish package distributions to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| if: ${{ github.event.inputs.dry-run == 'false' }} | |
| with: | |
| packages-dir: ./artifacts/ | |
| print-hash: true |