Skip to content

Commit a14acde

Browse files
committed
1 parent 9bd5cfc commit a14acde

File tree

1 file changed

+61
-30
lines changed

1 file changed

+61
-30
lines changed

.github/workflows/python_publish.yml

Lines changed: 61 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -26,43 +26,74 @@ on:
2626
release:
2727
types: [published]
2828

29-
permissions:
30-
contents: read
31-
3229
jobs:
33-
deploy:
34-
30+
build:
31+
name: Build OpenHTF distribution
3532
runs-on: ubuntu-latest
3633

3734
steps:
3835
- uses: actions/checkout@v4
36+
with:
37+
persist-credentials: false
3938
- name: Set up Python
4039
uses: actions/setup-python@v5
4140
with:
42-
python-version: '3.7'
43-
- name: Install dependencies
44-
run: |
45-
python -m pip install --upgrade pip
46-
python -m pip install tox tox-gh-actions
47-
pip install coveralls
48-
wget https://github.com/protocolbuffers/protobuf/releases/download/v21.6/protoc-21.6-linux-x86_64.zip
49-
unzip protoc-21.6-linux-x86_64.zip
50-
sudo cp bin/protoc /usr/bin/protoc && sudo chmod 777 /usr/bin/protoc
51-
sudo cp -r include/. /usr/include && sudo chmod -R +r /usr/include/google
52-
protoc --version
53-
sudo apt-get install -y libusb-1.0-0-dev libprotobuf-dev swig
54-
pip install build
55-
- name: Build package
56-
run: python -m build
57-
- name: Publish distribution to Test PyPI
58-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
41+
python-version: '3.13'
42+
- name: Install pypa/build
43+
run: >-
44+
python3 -m
45+
pip install
46+
build
47+
--user
48+
- name: Build a binary wheel and source tarball
49+
run: python3 -m build
50+
- name: Store the distribution packages
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: python-package-distributions
54+
path: dist/
55+
56+
publish-to-pypi:
57+
name: Publish OpenHTF distribution to PyPI
58+
if: startsWith(github.ref, 'refs/tags')
59+
needs:
60+
- build
61+
runs-on: ubuntu-latest
62+
environment:
63+
name: pypi
64+
url: https://pypi.org/p/openhtf
65+
permissions:
66+
id-token: write
67+
steps:
68+
- name: Download all the dists
69+
uses: actions/download-artifact@v4
70+
with:
71+
name: python-package-distributions
72+
path: dist/
73+
- name: Publish distribution to PyPI
74+
uses: pypa/gh-action-pypi-publish@release/v1
75+
76+
publish-to-testpypi:
77+
name: Publish OpenHTF distribution to TestPyPI
78+
needs:
79+
- build
80+
runs-on: ubuntu-latest
81+
82+
environment:
83+
name: testpypi
84+
url: https://test.pypi.org/p/openhtf
85+
86+
permissions:
87+
id-token: write
88+
89+
steps:
90+
- name: Download all the dists
91+
uses: actions/download-artifact@v4
5992
with:
60-
password: ${{ secrets.TESTPYPI_PUBLISH_PASSWORD }}
61-
repository_url: https://test.pypi.org/legacy/
62-
- name: Publish package to PyPI
63-
if: startsWith(github.ref, 'refs/tags')
64-
uses: pypa/gh-action-pypi-publish@76f52bc884231f62b9a034ebfe128415bbaabdfc
93+
name: python-package-distributions
94+
path: dist/
95+
- name: Publish distribution to TestPyPI
96+
uses: pypa/gh-action-pypi-publish@release/v1
6597
with:
66-
user: __token__
67-
password: ${{ secrets.PYPI_PUBLISH_PASSWORD }}
68-
skip_existing: true
98+
repository-url: https://test.pypi.org/legacy/
99+

0 commit comments

Comments
 (0)