Update README.md #17
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: Test PyPI deploy | |
on: | |
push: | |
branches: | |
- "**" | |
jobs: | |
generate_version: | |
name: Generate version | |
runs-on: ubuntu-latest | |
steps: | |
- name: Generate version file | |
run: echo "0.0.$(date "+%s")" > VERSION | |
- name: Upload version artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: VERSION | |
path: VERSION | |
build_sdist: | |
name: Build SDist | |
runs-on: ubuntu-latest | |
needs: generate_version | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Download version | |
uses: actions/download-artifact@v4 | |
with: | |
name: VERSION | |
path: . | |
- name: Update version | |
run: sed -i "s/^version.*\$/version = \"$(cat VERSION)\"/g" pyproject.toml | |
- name: Build SDist | |
run: pipx run build --sdist | |
- name: Check metadata | |
run: pipx run twine check dist/* | |
- name: Upload sources | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-sdist | |
path: dist/*.tar.gz | |
build_wheels: | |
name: Build wheels on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
needs: generate_version | |
strategy: | |
matrix: | |
# os: [ubuntu-latest, macos-13, macos-14] currently only works on Linux | |
os: [ubuntu-latest] | |
steps: | |
- name: Checkout the repository | |
uses: actions/checkout@v4 | |
with: | |
submodules: 'recursive' | |
- name: Download version | |
uses: actions/download-artifact@v4 | |
with: | |
name: VERSION | |
path: . | |
- name: Update version | |
run: sed -i "s/^version.*\$/version = \"$(cat VERSION)\"/g" pyproject.toml | |
- name: Build wheels | |
uses: pypa/[email protected] | |
- name: Upload wheels | |
uses: actions/upload-artifact@v4 | |
with: | |
name: cibw-wheels-${{ matrix.os }} | |
path: wheelhouse/*.whl | |
publish: | |
name: Publish to PyPI | |
needs: [build_wheels, build_sdist] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: "3.x" | |
- name: Download artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: cibw-* | |
path: dist | |
merge-multiple: true | |
- name: Push to test PyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
repository-url: "https://test.pypi.org/legacy/" | |
user: __token__ | |
password: ${{ secrets.TESTPYPI_TOKEN }} |