-
Notifications
You must be signed in to change notification settings - Fork 2
50 lines (40 loc) · 1.26 KB
/
deploy-package-to-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
# Deploy package to PyPi when a new VERSION is release to the main branch
# Author: Matt Clifford <[email protected]>
# License: BSD 3-Clause License
name: Upload Python Package to PyPi
on:
push:
branches:
- main
permissions:
contents: read
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Get Version numbers
run: |
echo "code_version=$(./dev_resources/scripts/get_local_version.py)" >> $GITHUB_ENV
echo "pypi_version=$(./dev_resources/scripts/get_latest_pypi_version.py)" >> $GITHUB_ENV
- name: Set up Python
if: env.code_version != env.pypi_version
uses: actions/setup-python@v3
with:
python-version: '3.9'
- name: Install base python deps
if: env.code_version != env.pypi_version
run: |
python -m pip install --upgrade pip
pip install packaging
- name: Build package
if: env.code_version != env.pypi_version
run: |
pip install build
python -m build
- name: Publish package
if: env.code_version != env.pypi_version
uses: pypa/gh-action-pypi-publish@27b31702a0e7fc50959f5ad993c78deac1bdfc29
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}