55
66jobs :
77 publish :
8- name : Deploy release to PyPI
8+ name : Publish release to PyPI
99 runs-on : ubuntu-latest
1010 steps :
1111 - name : Checkout source code
12- uses : actions/checkout@v3
13- - name : Set up Python
14- uses : actions/setup-python@v4
12+ uses : actions/checkout@v4
13+ - name : Restore cached virtualenv
14+ id : restore-venv-cache
15+ uses : actions/cache/restore@v4
1516 with :
16- python-version : 3.9
17- - name : Install dependencies
18- run : pip install .
17+ path : ./venv
18+ key : ${{ runner.os }}-3.9-venv-${{ hashFiles('**/pyproject.toml') }}
19+ - name : Build venv
20+ if : steps.restore-venv-cache.outputs.cache-hit != 'true'
21+ run : |
22+ python -m venv ./venv
23+ ./venv/bin/python -m pip install .
24+
1925 # [BJ] Shouldn't we run tests here to prevent an easily preventable catastrophe?
2026 # Or is test.yml being ran when we publish a package?
2127 - name : Build package
2228 # [TODO] We need to confirm this produces the same exact result as `python setup.py sdist`
2329 run : python -m build
2430 - name : Publish package to PyPI
25- uses : pypa/gh-action-pypi-publish@v1.8.10
31+ uses : pypa/gh-action-pypi-publish@v1.12.4
2632 with :
2733 user : __token__
2834 password : ${{ secrets.PYPI_PASSWORD }}
@@ -31,14 +37,13 @@ jobs:
3137 rm -rf ./docs/_build
3238 tox -e docs
3339 - name : Upload docs
34- uses : actions/upload-artifact@v3
40+ uses : actions/upload-artifact@v4
3541 with :
3642 name : python_sdk_docs
3743 path : docs/_build/html
38- # Test upload
39- # - name: Publish package to TestPyPI
40- # uses: pypa/gh-action-pypi-publish@master
41- # with:
42- # user: __token__
43- # password: ${{ secrets.TEST_PYPI_PASSWORD }}
44- # repository_url: https://test.pypi.org/legacy/
44+ - name : Cache virtualenv
45+ uses : actions/cache/save@v4
46+ if : steps.restore-venv-cache.outputs.cache-hit != 'true'
47+ with :
48+ path : ./venv
49+ key : ${{ steps.restore-venv-cache.outputs.cache-primary-key }}
0 commit comments