Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 67 additions & 29 deletions .github/workflows/python_publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,43 +26,81 @@ on:
release:
types: [published]

permissions:
contents: read

jobs:
deploy:

build:
name: Build OpenHTF distribution
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: '3.7'
- name: Install dependencies
python-version: '3.13'
- name: Install pypa/build
run: >-
python3 -m
pip install
build
--user
- name: Install build prerequisites
run: |
python -m pip install --upgrade pip
python -m pip install tox tox-gh-actions
pip install coveralls
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.6/protoc-21.6-linux-x86_64.zip
unzip protoc-21.6-linux-x86_64.zip
sudo cp bin/protoc /usr/bin/protoc && sudo chmod 777 /usr/bin/protoc
sudo cp -r include/. /usr/include && sudo chmod -R +r /usr/include/google
protoc --version
sudo apt-get install -y libusb-1.0-0-dev libprotobuf-dev swig
pip install build
- name: Build package
run: python -m build
- name: Publish distribution to Test PyPI
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
sudo apt-get install -y libusb-1.0-0-dev libprotobuf-dev swig libevent-dev
- name: Setup protoc
uses: arduino/setup-protoc@v3
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Build a binary wheel and source tarball
run: python3 -m build
- name: Store the distribution packages
uses: actions/upload-artifact@v4
with:
name: python-package-distributions
path: dist/

publish-to-pypi:
name: Publish OpenHTF distribution to PyPI
if: startsWith(github.ref, 'refs/tags')
needs:
- build
runs-on: ubuntu-latest
environment:
name: pypi
url: https://pypi.org/p/openhtf
permissions:
id-token: write
steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
name: python-package-distributions
path: dist/
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1

publish-to-testpypi:
name: Publish OpenHTF distribution to TestPyPI
needs:
- build
runs-on: ubuntu-latest

environment:
name: testpypi
url: https://test.pypi.org/p/openhtf

permissions:
id-token: write

steps:
- name: Download all the dists
uses: actions/download-artifact@v4
with:
password: ${{ secrets.TESTPYPI_PUBLISH_PASSWORD }}
repository_url: https://test.pypi.org/legacy/
- name: Publish package to PyPI
if: startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
name: python-package-distributions
path: dist/
- name: Publish distribution to TestPyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_PUBLISH_PASSWORD }}
skip_existing: true
repository-url: https://test.pypi.org/legacy/

Loading