release #12
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: release | |
on: | |
push: | |
tags: | |
- '*' | |
branches: [ main ] | |
workflow_dispatch: | |
jobs: | |
build: | |
name: build ${{ matrix.os }} ${{ matrix.py }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: ["ubuntu-latest", "macos-latest"] | |
fail-fast: false | |
steps: | |
- uses: actions/checkout@v4 | |
- name: extra env vars for macOS | |
if: matrix.os == 'macos-latest' | |
run: | | |
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" | |
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" | |
- name: build | |
run: | | |
pip install build | |
python -m build | |
echo "WHEEL_NAME=$(ls dist/*.whl)" >> $GITHUB_ENV | |
echo "SDIST_NAME=$(ls dist/*.tar.gz)" >> $GITHUB_ENV | |
- name: test | |
run: | | |
pip install dist/*.whl pytest | |
pytest | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ env.WHEEL_NAME }} | |
path: "dist/*.whl" | |
- uses: actions/upload-artifact@v4 | |
# only do this once | |
if: matrix.os == 'ubuntu-latest' | |
with: | |
name: ${{ env.SDIST_NAME }} | |
path: "dist/*.tar.gz" | |
upload: | |
needs: [build] | |
if: startsWith(github.ref, 'refs/tags/') | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
merge-multiple: true | |
- name: Copy artifacts to dist/ folder | |
run: | | |
mkdir -p dist/ | |
mv *.tar.gz dist/ | |
mv *.whl dist/ | |
- name: Upload | |
uses: pypa/[email protected] | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
skip_existing: true |