release #18
Workflow file for this run
This file contains hidden or 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: | | |
# brew install openssl | |
# export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" | |
# export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" | |
- name: build | |
run: | | |
pip install build | |
export LDFLAGS="-L/opt/homebrew/opt/openssl@3/lib" | |
export CPPFLAGS="-I/opt/homebrew/opt/openssl@3/include" | |
python -m build | |
cd dist | |
echo "WHEEL_NAME=$(ls *.whl)" >> $GITHUB_ENV | |
echo "SDIST_NAME=$(ls *.tar.gz)" >> $GITHUB_ENV | |
- 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" | |
- name: test | |
run: | | |
pip install dist/*.whl pytest | |
pytest | |
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 |