-
Notifications
You must be signed in to change notification settings - Fork 1
57 lines (49 loc) · 1.71 KB
/
deploy_pypi.yml
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
57
name: Deploy to PyPI 📦
# trigger deploy_to_pypi workflow once deploy_to_testpypi has successfully completed
on:
workflow_run:
workflows: [Deploy to TestPyPI 📦]
types:
- completed
# allow for workflow to be manually initiated from the Actions tab
workflow_dispatch:
jobs:
build:
name: Deploy to PyPI 📦
runs-on: ubuntu-latest # platform: [ubuntu-latest, macos-latest, windows-latest]
strategy:
matrix:
python-version: [3.8] #deploying using one Python version on 1 runner
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
# install all required modules and dependancies using pip and setup.py installation
- name: Install dependencies
run: |
python -m pip install --upgrade pip
python3 setup.py install
pip install build
# Build package
- name: Build package
run: |
python -m build
# publish to pypi
- name: Publish package
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_TOKEN }}
#sleep for 30 seconds to ensure that distribution package has finised uploading to Test PyPI
- name: Wait / Sleep
uses: jakejarvis/wait-action@master
with:
time: '30s'
# download package of iso3166_2 from PYPI server to ensure it uploaded correctly
- name: Install iso3166_2 from PyPI
run: |
pip install iso3166_2 --upgrade
echo -e "import iso3166_2 as iso3166_2" | python3
echo "iso3166_2 successfully installed"