| # Copyright 2022 CeresDB Project Authors. Licensed under Apache-2.0. |
| |
| name: Release |
| |
| on: |
| push: |
| tags: |
| - 'v*' |
| |
| jobs: |
| build: |
| runs-on: ${{ matrix.platform.os }} |
| strategy: |
| matrix: |
| platform: |
| - os: macos-latest |
| target: x86_64 |
| - os: macos-latest |
| target: aarch64 |
| - os: ubuntu-latest |
| target: x86_64 |
| - os: windows-latest |
| target: x86_64 |
| steps: |
| - uses: actions/checkout@v2 |
| - uses: actions/setup-python@v4 |
| with: |
| python-version: '3.10' |
| architecture: x64 |
| - name: Install Rust toolchain |
| uses: actions-rs/toolchain@v1 |
| with: |
| profile: minimal |
| - uses: Swatinem/rust-cache@v2 |
| - name: Build source distribution |
| uses: messense/maturin-action@v1 |
| if: ${{ matrix.platform.os == 'ubuntu-latest' && matrix.platform.target == 'x86_64' }} |
| with: |
| command: sdist |
| args: --out dist |
| - name: Build wheels |
| uses: messense/maturin-action@v1 |
| with: |
| target: ${{ matrix.platform.target }} |
| manylinux: manylinux2014 |
| args: --release --out dist |
| - name: Upload wheels |
| uses: actions/upload-artifact@v2 |
| with: |
| name: wheels |
| path: dist |
| |
| release: |
| name: Release |
| runs-on: ubuntu-latest |
| if: "startsWith(github.ref, 'refs/tags/')" |
| needs: [ build ] |
| steps: |
| - uses: actions/download-artifact@v2 |
| with: |
| name: wheels |
| - uses: actions/setup-python@v4 |
| with: |
| python-version: '3.10' |
| - name: Publish to PyPI |
| env: |
| TWINE_USERNAME: __token__ |
| TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} |
| run: | |
| pip install twine |
| twine upload --skip-existing * |