-
Notifications
You must be signed in to change notification settings - Fork 1
75 lines (61 loc) · 1.97 KB
/
build-deploy-all.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
name: Build and Deploy Package and Docs
on:
pull_request:
branches:
- main
env:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
permissions:
contents: write
pull-requests: write
packages: write
id-token: write
attestations: write
jobs:
build-and-publish:
runs-on: ubuntu-latest
env:
PYPI_USERNAME: ${{ secrets.PYPI_USERNAME }}
PYPI_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
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
# Build and deploy mkdocs to GitHub Pages
- name: Build and deploy mkdocs
run: |
mkdocs build
mkdocs gh-deploy --force
# 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:
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# 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 }}