Merge branch 'main' of https://github.com/jozu-ai/pykitops #9
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: Build and Deploy Package and Docs | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
build-and-publish: | |
runs-on: ubuntu-latest | |
env: | |
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
GH_TOKEN: ${{ secrets.GITOPS_PAT }} | |
steps: | |
# Checkout the repository | |
- name: Check out repository | |
uses: actions/checkout@v4 | |
# Set up Python | |
- name: Set up Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
# Install dependencies | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install hatch twine mkdocs mkdocs-material "mkdocstrings[python]" bump2version | |
# Configure Git author identity | |
- name: Configure Git author | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
# Bump version | |
- name: Bump version and push tag | |
run: | | |
bump2version patch # You can specify 'patch', 'minor', or 'major' based on your versioning needs | |
env: | |
GH_TOKEN: ${{ secrets.GITOPS_PAT }} | |
# Build the package distributables and publish to PyPI | |
- name: Build package | |
run: | | |
hatch build | |
- name: Publish package to PyPI | |
run: twine upload dist/* | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
# Build and deploy mkdocs to GitHub Pages | |
- name: Build and deploy mkdocs | |
run: | | |
mkdocs build | |
mkdocs gh-deploy --force |