add changelog #27
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish to PyPI | |
on: [push] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python distributions to PyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v4 | |
with: | |
python-version: 3.9 | |
- name: Update package cache | |
run: sudo apt-get -yq update | |
- name: Install Deps for installing project | |
run: pip install Sphinx coverage wheel | |
- name: Fetch date for version bump | |
run: echo "new_version=$(date +'%Y%m%d%H%M')" >> $GITHUB_ENV | |
- name: Replace version in setup.py | |
if: startsWith(github.ref, 'refs/tags/v') != true && github.ref == 'refs/heads/main' | |
# Only replace the version if we are not on a tag and on main. | |
run: sed -i '/__version__ = "[0-9].[0-9].[0-9]/s/.$/.'${{ env.new_version }}'"/g' libcobblersignatures/__init__.py | |
- name: Install Deps with pip | |
run: pip install . | |
- name: Install pypa/build | |
run: python -m pip install build --user | |
- name: Build a binary wheel and a source tarball | |
run: python setup.py sdist bdist_wheel | |
- name: Publish distribution to Test PyPI | |
if: github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.TEST_PYPI_API_TOKEN }} | |
repository_url: https://test.pypi.org/legacy/ | |
- name: Publish distribution to PyPI | |
if: startsWith(github.ref, 'refs/tags/v') | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |