chore: publish release #53
Workflow file for this run
This file contains 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: Build | |
on: | |
push: | |
tags: | |
- "v*" | |
jobs: | |
build_linux: | |
name: Build Linux wheels | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
python: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pybindgen | |
- name: Install system dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y golang | |
- name: Configure Go | |
run: | | |
echo "GOPATH=$HOME/go" >> $GITHUB_ENV | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name: Install Go tools | |
run: | | |
go install golang.org/x/tools/cmd/goimports@latest | |
go install github.com/go-python/gopy@latest | |
- name: Clone verifier repo | |
uses: actions/checkout@v4 | |
with: | |
repository: tinfoilsh/verifier | |
ref: v0.0.21 | |
path: verifier | |
- name: Generate Go bindings | |
run: | | |
cd verifier | |
gopy build -output=tinfoil_verifier -vm=python3 github.com/tinfoilsh/verifier/client | |
mv tinfoil_verifier ../tinfoil/ | |
cd .. | |
rm -rf verifier | |
- name: Build wheels | |
run: | | |
python -m pip install build | |
python -m build | |
python rename.py | |
for wheel in dist/*linux*.whl; do | |
if [ -f "$wheel" ]; then | |
mv "$wheel" "${wheel//manylinux_2_39/manylinux2014}" | |
fi | |
done | |
- name: Upload Linux wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: linux-wheels-${{ matrix.python }} | |
path: dist/*.whl | |
build_macos: | |
name: Build macOS wheels (${{ matrix.os }}) | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-13-xlarge, macos-14] | |
python: ["3.10", "3.11", "3.12", "3.13"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install pybindgen | |
- name: Install system dependencies | |
run: | | |
brew install go | |
- name: Configure Go | |
run: | | |
echo "GOPATH=$HOME/go" >> $GITHUB_ENV | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name: Install Go tools | |
run: | | |
go install golang.org/x/tools/cmd/goimports@latest | |
go install github.com/go-python/gopy@latest | |
- name: Clone verifier repo | |
uses: actions/checkout@v4 | |
with: | |
repository: tinfoilsh/verifier | |
ref: v0.0.21 | |
path: verifier | |
- name: Generate Go bindings | |
run: | | |
cd verifier | |
gopy build -output=tinfoil_verifier -vm=python3 github.com/tinfoilsh/verifier/client | |
mv tinfoil_verifier ../tinfoil/ | |
cd .. | |
rm -rf verifier | |
- name: Determine architecture | |
id: detect_arch | |
run: | | |
if [ "${{ matrix.os }}" = "macos-13-xlarge" ]; then | |
echo "arch=x86_64" >> $GITHUB_ENV | |
else | |
echo "arch=arm64" >> $GITHUB_ENV | |
fi | |
- name: Build wheels | |
run: | | |
python -m pip install build | |
python -m build | |
python rename.py | |
- name: Upload macOS wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: macos-${{ env.arch }}-wheels-${{ matrix.python }} | |
path: dist/*.whl | |
build_sdist: | |
name: Build source distribution | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
- name: Install build tools | |
run: python -m pip install --upgrade pip build | |
- name: Build sdist | |
run: python -m build --sdist | |
- name: Upload sdist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: sdist | |
path: dist/*.tar.gz | |
release: | |
name: Release | |
runs-on: ubuntu-latest | |
needs: [build_linux, build_macos, build_sdist] | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: dist | |
- name: Organize artifacts | |
run: | | |
mv dist/linux-wheels-*/*.whl dist/ || true | |
mv dist/macos-*-wheels-*/*.whl dist/ || true | |
mv dist/sdist/*.tar.gz dist/ || true | |
rm -rf dist/linux-wheels-* dist/macos-*-wheels-* dist/sdist || true | |
ls -l dist | |
- name: Create release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: dist/* | |
- name: Publish to PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 |