Build and upload to PyPI #120
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 and upload to PyPI | |
on: | |
push: | |
tags: | |
- "*" | |
workflow_dispatch: | |
jobs: | |
build_static: | |
name: Build static files | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Run tailwindcss | |
run: | | |
pipx install pytailwindcss | |
tailwindcss -i styles/main.css -o main.css --minify | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: static | |
path: main.css | |
sdist: | |
name: Build source distribution | |
needs: build_static | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: static | |
path: src/dj_tracker/static/dj_tracker/css | |
- name: Compile Cython files | |
run: | | |
pipx run --spec Cython==3.0.11 cython src/dj_tracker/*.pyx --fast-fail -Werror -3 | |
- name: Build sdist | |
run: pipx run build --sdist | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: dist/*.tar.gz | |
wheels: | |
name: Build wheels on ${{ matrix.os }} | |
needs: build_static | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: | |
- ubuntu-latest | |
- windows-latest | |
- macOS-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: static | |
path: src/dj_tracker/static/dj_tracker/css | |
- name: Set up QEMU | |
if: runner.os == 'Linux' | |
uses: docker/setup-qemu-action@v2 | |
with: | |
platforms: all | |
- name: Build wheels | |
uses: pypa/[email protected] | |
env: | |
CIBW_SKIP: pp* | |
CIBW_ARCHS_LINUX: "auto aarch64" | |
CIBW_ARCHS_MACOS: "x86_64 universal2 arm64" | |
- uses: actions/upload-artifact@v3 | |
with: | |
path: ./wheelhouse/*.whl | |
upload_pypi: | |
name: Upload package to Pypi | |
needs: | |
- sdist | |
- wheels | |
runs-on: ubuntu-latest | |
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') | |
steps: | |
- uses: actions/download-artifact@v3 | |
with: | |
name: artifact | |
path: dist | |
- uses: pypa/[email protected] | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} |