-
Notifications
You must be signed in to change notification settings - Fork 15
51 lines (47 loc) · 1.49 KB
/
publish-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
51
name: Publish
on:
push:
branches:
- main
jobs:
build-n-publish:
name: Build and publish koku-nise to PyPI
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3.2.0
with:
fetch-depth: 0
- name: Set up Python
uses: actions/setup-python@v4.4.0
with:
python-version: 3.8
- name: Install dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install pipenv-setup setuptools wheel twine chardet vistir==0.6.1
- name: Build and publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.pypi_password }}
run: |
set -e
VERSION=$(python setup.py --version)
if [ ! -z $(git tag -l "${VERSION}") ]; then
echo "Tag already exists, doing nothing";
exit_code=1
elif [ -z "$(pipenv-setup check)" ]; then
echo "setup.py out of sync with Pipfile"
exit_code=1
else
echo "Creating tag ${VERSION}";
git config --local user.email "cost-mgmt@redhat.com"
git config --local user.name "Koku-Nise Release Action"
git tag ${VERSION};
git push origin --tags;
python3 setup.py sdist bdist_wheel
python3 -m twine upload dist/*
exit_code=0
fi
exit $exit_code