-
Notifications
You must be signed in to change notification settings - Fork 2
56 lines (46 loc) · 1.53 KB
/
pypi.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
name: Publish Python package
on:
push:
branches:
- main
- master
pull_request:
jobs:
publish:
name: Build and publish python packages
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: get release info
id: release_info
run: |
version="$(awk '/^## / { print tolower($2) }' CHANGELOG.md | head -1)"
echo "::set-output name=version::$version"
- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7
- name: Install dependencies
run: python -m pip install --upgrade pip setuptools wheel
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -r requirements.txt
- name: Cache pip
uses: actions/cache@v2
with:
# This path is specific to Ubuntu
path: ~/.cache/pip
# Look to see if there is a cache hit for the corresponding requirements file
key: ${{ runner.os }}-pip-${{ hashFiles('requirements.txt') }}
restore-keys: |
${{ runner.os }}-pip-
${{ runner.os }}-
- name: Build dist file
run: |
python setup.py sdist bdist_wheel
- name: Publish distribution to PyPI
if: github.event_name == 'push' && github.ref == 'refs/heads/master' && steps.release_info.outputs.version != 'unreleased'
uses: pypa/gh-action-pypi-publish@master
with:
password: ${{ secrets.pypi_password }}