@@ -6,7 +6,6 @@ name: Latest release
66env :
77 CACHE_VERSION : 1
88 DEFAULT_PYTHON : 3.9
9- PRE_COMMIT_HOME : ~/.cache/pre-commit
109
1110# Only run on merges
1211on :
1615 - main
1716
1817jobs :
19- # Prepare default python version environment
20- prepare :
21- runs-on : ubuntu-latest
22- name : Prepare
23- steps :
24- - name : Check out committed code
25- uses : actions/checkout@v2
26- - name : Set up Python ${{ env.DEFAULT_PYTHON }}
27- id : python
28- uses : actions/setup-python@v2
29- with :
30- python-version : ${{ env.DEFAULT_PYTHON }}
31- - name : Restore base Python ${{ env.DEFAULT_PYTHON }} virtual environment
32- id : cache-venv
33- uses : actions/cache@v2
34- with :
35- path : venv
36- key : >-
37- ${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
38- steps.python.outputs.python-version }}-${{
39- hashFiles('requirements_test.txt') }}-${{
40- hashFiles('setup.py') }}
41- restore-keys : |
42- ${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements_test.txt') }}-${{ hashFiles('setup.py') }}-
43- ${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-${{ hashFiles('requirements_test.txt') }}
44- ${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{ steps.python.outputs.python-version }}-
45- - name : Create Python virtual environment
46- if : steps.cache-venv.outputs.cache-hit != 'true'
47- run : |
48- python -m venv venv
49- . venv/bin/activate
50- pip install -U pip setuptools
51- pip install -e .
52- pip install -r requirements_test.txt
53- - name : Restore pre-commit environment from cache
54- id : cache-precommit
55- uses : actions/cache@v2
56- with :
57- path : ${{ env.PRE_COMMIT_HOME }}
58- key : |
59- ${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-${{ hashFiles('.pre-commit-config.yaml') }}
60- restore-keys : |
61- ${{ env.CACHE_VERSION}}-${{ runner.os }}-pre-commit-
62- - name : Install pre-commit dependencies
63- if : steps.cache-precommit.outputs.cache-hit != 'true'
64- run : |
65- . venv/bin/activate
66- pre-commit install-hooks
67-
6818 publishing :
6919 name : Build and publish Python 🐍 distributions 📦 to PyPI
7020 runs-on : ubuntu-latest
@@ -79,25 +29,10 @@ jobs:
7929 uses : actions/setup-python@v2
8030 with :
8131 python-version : ${{ env.DEFAULT_PYTHON }}
82- - name : Restore base Python ${{ env.DEFAULT_PYTHON }} virtual environment
83- id : cache-venv
84- uses : actions/cache@v2
85- with :
86- path : venv
87- key : >-
88- ${{ env.CACHE_VERSION}}-${{ runner.os }}-base-venv-${{
89- steps.python.outputs.python-version }}-${{
90- hashFiles('requirements_test.txt') }}-${{
91- hashFiles('setup.py') }}
92- - name : Fail job if Python cache restore failed
93- if : steps.cache-venv.outputs.cache-hit != 'true'
94- run : |
95- echo "Failed to restore Python virtual environment from cache"
96- exit 1
9732 - name : Build a distribution
9833 run : >-
9934 python setup.py sdist
100- - name : Publish distribution 📦 to Test PyPI
35+ - name : Publish distribution 📦 to PyPI
10136 uses : pypa/gh-action-pypi-publish@master
10237 with :
10338 password : ${{ secrets.pypi_token }}
0 commit comments