Build(deps): Bump actions/download-artifact in /.github/workflows #20
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 Python distributions to PyPI | |
on: [push] | |
jobs: | |
build-n-publish: | |
name: Build and publish Python distributions to TestPyPI | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Install package deps | |
run: >- | |
sudo apt-get install -y | |
git | |
tar | |
make | |
gcc | |
python3-dev | |
python3-wheel | |
python3-build | |
python3-setuptools | |
python3-pip | |
python3-libvirt | |
python3-sphinx | |
python3-sphinx-rtd-theme | |
- name: Install dependencies | |
run: pip3 install .[lint,test,docs] | |
- 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' koan/__init__.py | |
- name: Build a binary wheel and a source tarball | |
run: make release | |
- name: Publish distribution to Test PyPI | |
if: github.ref == 'refs/heads/main' | |
uses: pypa/gh-action-pypi-publish@master | |
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@master | |
with: | |
password: ${{ secrets.PYPI_API_TOKEN }} |