Skip to content

Auto Update and Publish to PyPI #244

Auto Update and Publish to PyPI

Auto Update and Publish to PyPI #244

name: Auto Update and Publish to PyPI
# This workflow is triggered on push to main branch and on a schedule every day at midnight. It also updates any dependencies and runs tests before publishing to PyPI.
# NOTE: the current workflow requires manual intervention in updating dependencies.
# ...If the dependencies are not changed, then the workflow will continue and publish to PyPI with same dependencies as defined.
on:
push:
branches:
- main # Currently triggers on any push to main branch
schedule:
- cron: "0 0 * * *" # Added a scheduled trigger to run every day at midnight
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install build tool
run: |
python -m pip install --upgrade pip
pip install build
- name: Build package
run: |
python -m build
- name: Publish distribution to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
repository-url: https://upload.pypi.org/legacy/