Merge pull request #13 from mhucka/mhucka-installation-suggestion #48
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: Pre-release TypedUnits | |
on: | |
push: | |
branches: | |
- main | |
permissions: | |
contents: read | |
jobs: | |
create_version: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Create version | |
run: | | |
mkdir version | |
echo "$(python _version.py).dev$(date '+%Y%m%d%H%M%S')" > version/version.txt | |
cat version/version.txt | |
- uses: actions/upload-artifact@master | |
with: | |
name: version-file | |
path: version | |
build_wheels: | |
runs-on: ${{ matrix.os }} | |
needs: [create_version] | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: ubuntu-latest | |
arch: x86_64 | |
- os: windows-latest | |
arch: auto | |
- os: macos-latest | |
arch: auto | |
- os: macos-13 | |
arch: auto | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install build cibuildwheel | |
- uses: actions/download-artifact@master | |
with: | |
name: version-file | |
path: version | |
- name: Build package | |
env: | |
CIBW_BUILD: "cp310* cp311* cp312*" | |
CIBW_ARCHS: ${{ matrix.arch }} | |
CIBW_SKIP: "*musllinux*" | |
run: | | |
python -m cibuildwheel --output-dir wheelhouse | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: python-wheels-${{ matrix.os }} | |
path: ./wheelhouse/*.whl | |
release-wheels: | |
name: Publish all wheels | |
needs: [build_wheels] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download build artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: python-wheels-* | |
merge-multiple: true | |
path: wheelhouse/ | |
- name: Publish package to testpypi | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
repository_url: https://test.pypi.org/legacy/ | |
user: __token__ | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
packages_dir: wheelhouse/ | |
verbose: true | |
- name: Publish package to pypi | |
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: wheelhouse/ | |
verbose: true |