1+ name : Python package
2+
3+ on :
4+ release :
5+ types : ['published']
6+
7+
8+ jobs :
9+
10+ page_build :
11+ name : " Build documentation"
12+ runs-on : ubuntu-latest
13+ steps :
14+ - uses : actions/checkout@v4
15+ - name : Set up Python
16+ uses : actions/setup-python@v4
17+ with :
18+ python-version : ' 3.10'
19+ - name : Install dependencies
20+ run : |
21+ python -m pip install --upgrade pip
22+ python -m pip install --upgrade build
23+ pip install -r requirements.txt
24+ pip install -r build_requirements.txt
25+ pip install -e .
26+ - name : Setup Pages
27+ uses : actions/configure-pages@v4
28+ - name : Build docs
29+ run : |
30+ mkdocs build --verbose --clean --strict
31+ - name : Upload page artifact
32+ uses : actions/upload-pages-artifact@v3
33+ with :
34+ path : ./site
35+
36+ pypi_build :
37+ name : Build pypi package
38+ runs-on : ubuntu-latest
39+ steps :
40+ - uses : actions/checkout@v4
41+ - name : Set up Python
42+ uses : actions/setup-python@v4
43+ with :
44+ python-version : ' 3.10'
45+ - name : Install dependencies
46+ run : |
47+ python -m pip install --upgrade pip
48+ python -m pip install --upgrade build
49+ pip install -r requirements.txt
50+ pip install -r build_requirements.txt
51+ pip install -e .
52+ - name : Build pypi package
53+ run : |
54+ python -m build
55+ - name : Upload build package as artifact
56+ uses : actions/upload-artifact@v3
57+ with :
58+ name : python-package-distributions
59+ path : dist/
60+
61+ deploy_page :
62+ name : ' Deploy release documentation'
63+ needs : [page_build, pypi_build]
64+
65+ # Grant GITHUB_TOKEN the permissions required to make a Pages deployment
66+ permissions :
67+ pages : write # to deploy to Pages
68+ id-token : write # to verify the deployment originates from an appropriate source
69+ actions : read # to download an artifact uploaded by `actions/upload-pages-artifact@v3`
70+
71+ # Deploy to the github-pages environment
72+ environment :
73+ name : github-pages
74+ url : ${{ steps.deployment.outputs.page_url }}
75+
76+ # Specify runner + deployment step
77+ runs-on : ubuntu-latest
78+ steps :
79+ - name : Deploy to GitHub Pages
80+ id : deployment
81+ uses : actions/deploy-pages@v4
82+
83+ deploy_pypi :
84+ name : Publish to pypi
85+ needs : [page_build, pypi_build]
86+ runs-on : ubuntu-latest
87+ environment :
88+ name : pypi
89+ url : https://pypi.org/p/keras-batchflow
90+ permissions :
91+ id-token : write
92+ steps :
93+ - name : Download all the dists
94+ uses : actions/download-artifact@v3
95+ with :
96+ name : python-package-distributions
97+ path : dist/
98+ - name : Publish distribution 📦 to PyPI
99+ uses : pypa/gh-action-pypi-publish@release/v1
100+ with :
101+ user : __token__
102+ password : ${{ secrets.PYPI_TOKEN }}
0 commit comments