Release #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*' | |
| jobs: | |
| build: | |
| name: Build wheels on ${{ matrix.os }} | |
| runs-on: ${{ matrix.os }} | |
| strategy: | |
| matrix: | |
| include: | |
| - os: ubuntu-latest | |
| rid: linux-x64 | |
| target: x86_64-unknown-linux-gnu | |
| ext: .so | |
| - os: macos-latest | |
| rid: universal2 | |
| target: universal2-apple-darwin | |
| ext: .dylib | |
| - os: windows-latest | |
| rid: win-x64 | |
| target: x86_64-pc-windows-msvc | |
| ext: .dll | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: recursive | |
| - name: Set version from tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| shell: bash | |
| run: | | |
| TAG_VERSION="${GITHUB_REF#refs/tags/v}" | |
| echo "Updating version in Cargo.toml to $TAG_VERSION" | |
| if [[ "${{ runner.os }}" == "macOS" ]]; then | |
| sed -i '' 's/^version = ".*"/version = "'$TAG_VERSION'"/' native_fisher_py/Cargo.toml | |
| else | |
| sed -i 's/^version = ".*"/version = "'$TAG_VERSION'"/' native_fisher_py/Cargo.toml | |
| fi | |
| - name: Install NativeAOT Dependencies (Linux) | |
| if: matrix.os == 'ubuntu-latest' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y clang zlib1g-dev libkrb5-dev | |
| - name: Setup .NET | |
| uses: actions/setup-dotnet@v4 | |
| with: | |
| dotnet-version: 8.0.x | |
| - name: Publish NativeAOT dylib | |
| shell: bash | |
| run: | | |
| cd native/ThermoNativeReader | |
| if [[ "${{ matrix.rid }}" == "universal2" ]]; then | |
| dotnet publish -r osx-x64 -c Release -p:PublishAot=true | |
| dotnet publish -r osx-arm64 -c Release -p:PublishAot=true | |
| mkdir -p ../../native_fisher_py/python/native_fisher_py/ | |
| lipo -create \ | |
| bin/Release/net8.0/osx-x64/publish/ThermoNativeReader.dylib \ | |
| bin/Release/net8.0/osx-arm64/publish/ThermoNativeReader.dylib \ | |
| -output ../../native_fisher_py/python/native_fisher_py/ThermoNativeReader.dylib | |
| else | |
| dotnet publish -r ${{ matrix.rid }} -c Release -p:PublishAot=true | |
| cp bin/Release/net8.0/${{ matrix.rid }}/publish/ThermoNativeReader${{ matrix.ext }} ../../native_fisher_py/python/native_fisher_py/ | |
| fi | |
| - name: Set up Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: '3.9' | |
| - name: Copy README | |
| run: cp README.md native_fisher_py/ | |
| - name: Build wheels | |
| uses: PyO3/maturin-action@v1 | |
| with: | |
| command: build | |
| args: --release --out dist --manifest-path native_fisher_py/Cargo.toml | |
| target: ${{ matrix.target }} | |
| - name: Upload wheels | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: wheels-${{ matrix.os }} | |
| path: dist/*.whl | |
| publish: | |
| name: Publish to PyPI | |
| needs: [build] | |
| runs-on: ubuntu-latest | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| permissions: | |
| id-token: write # Mandatory for trusted publishing | |
| steps: | |
| - uses: actions/download-artifact@v4 | |
| with: | |
| pattern: wheels-* | |
| merge-multiple: true | |
| path: dist | |
| - name: Publish to PyPI | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| with: | |
| print-hash: true |