Streamlit/UI -- branch sync #59
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: Python Package Publication | |
on: | |
pull_request: | |
types: [closed] | |
branches: [master] | |
paths: | |
- '**.cpp' | |
- '**.hpp' | |
- '**.py' | |
- 'setup.py' | |
- 'setup.cfg' | |
- 'pyproject.toml' | |
jobs: | |
linux-build: | |
runs-on: ubuntu-latest | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Get version | |
id: get_version | |
run: | | |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT | |
- name: Python wheels manylinux stable build | |
uses: RalfG/[email protected] | |
with: | |
python-versions: 'cp38-cp38 cp39-cp39 cp310-cp310 cp311-cp311' | |
- name: upload wheel | |
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel setuptools twine | |
twine upload dist/*-manylinux*.whl | |
continue-on-error: false | |
other-os-build: | |
runs-on: ${{ matrix.os }} | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_TOKEN }} | |
strategy: | |
matrix: | |
os: [macos-latest, windows-latest] | |
python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: 'true' | |
- name: Get version | |
id: get_version | |
run: | | |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: build wheel | |
run: | | |
python -m pip install --upgrade pip | |
python -m pip install wheel setuptools twine | |
python setup.py bdist_wheel | |
- name: upload wheel | |
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
run: | | |
twine upload dist/* | |
continue-on-error: false | |
release-build: | |
if: github.event.pull_request.merged == true || github.event_name == 'workflow_dispatch' | |
needs: [ linux-build, other-os-build ] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Get version | |
id: get_version | |
run: | | |
echo "version=$(python setup.py --version)" >> $GITHUB_OUTPUT | |
- name: Create release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release create "v${{ steps.get_version.outputs.version }}" \ | |
--repo="$GITHUB_REPOSITORY" \ | |
--title="${GITHUB_REPOSITORY#*/} ${{ steps.get_version.outputs.version }}" \ | |
--generate-notes |