Skip to content

[COST-4175] Fix AWS first of the month issue (#487) #179

[COST-4175] Fix AWS first of the month issue (#487)

[COST-4175] Fix AWS first of the month issue (#487) #179

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/[email protected]
with:
fetch-depth: 0
- name: Set up Python
uses: actions/[email protected]
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 -c requirements/build-constraints.txt
- 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 "[email protected]"
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